prisma-v7
Expert guidance for Prisma ORM v7 (7.0+). Use when working with Prisma schema files, migrations, Prisma Client queries, database setup, or when the user mentions Prisma, schema.prisma, @prisma/client, database models, or ORM. Covers ESM modules, driver adapters, prisma.config.ts, Rust-free client, a
Оригинален текст · няма потвърден превод на българскиПърво прочетете инструкцията.
Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.
GitHub хранилище- Звезди на репото
- 428
- Лиценз
- Не е посочен. Проверете в репозитория.
- Последна проверка на записа
- Няма посочена дата
Добавете в своя инструмент.
Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.
npx skills add aiskillstore/marketplaceСтраницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.
Откъс от SKILL.md
Началото на файла на автора, без превод.
Prisma ORM v7 Expert Skill
Comprehensive guidance for working with Prisma ORM version 7.x and later.
Core v7 Changes
1. ES Modules (ESM) Required
Prisma v7 ships as an ES module. Your project must use ESM:
package.json:
{
"type": "module"
}
tsconfig.json:
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"target": "ES2023",
"strict": true,
"esModuleInterop": true
}
}
2. Driver Adapters Required
All databases now require driver adapters. The Rust-free client provides better performance and smaller bundle sizes.
Available Adapters:
- PostgreSQL:
@prisma/adapter-pg(withpgdriver) - MySQL/MariaDB:
@prisma/adapter-mariadb(withmariadbdriver) - SQLite:
@prisma/adapter-better-sqlite3(withbetter-sqlite3) - CockroachDB:
@prisma/adapter-pg(withpgdriver) - Neon:
@prisma/adapter-neon(with@neondatabase/serverless) - PlanetScale:
@prisma/adapter-planetscale(with@planetscale/database) - D1 (Cloudflare):
@prisma/adapter-d1 - MSSQL:
@prisma/adapter-mssql
3. Generator Configuration
The output field is now required and the new prisma-client provider is standard:
generator client {
provider = "prisma-client"
output = "./generated/prisma"
}
Note: Client is no longer generated in node_modules by default.
4. Prisma Config File (prisma.config.ts)
Database URLs and CLI configuration now live in prisma.config.ts instead of the schema file.
Basic setup:
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env('DATABASE_URL'),
},
})
Note: For Bun, skip import 'dotenv/config' as it auto-loads .env files.
5. Schema Datasource Block
Remove url, directUrl, and shadowDatabaseUrl from schema.prisma:
v7 schema.prisma:
datasource db {
provider = "postgresql"
// url field removed - now in prisma.config.ts
}
generator client {
provider = "prisma-client"
output = "./generated/prisma"
}