一键导入
prisma-database-setup-sqlite
SQLite Setup. Reference when using this Prisma feature.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
SQLite Setup. Reference when using this Prisma feature.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
prisma db execute. Reference when using this Prisma feature.
prisma db pull. Reference when using this Prisma feature.
prisma db push. Reference when using this Prisma feature.
prisma db seed. Reference when using this Prisma feature.
prisma debug. Reference when using this Prisma feature.
prisma dev. Reference when using this Prisma feature.
| name | prisma-database-setup-sqlite |
| description | SQLite Setup. Reference when using this Prisma feature. |
| license | MIT |
| metadata | {"author":"prisma","version":"7.0.0"} |
Configure Prisma with SQLite.
In prisma/schema.prisma:
datasource db {
provider = "sqlite"
}
generator client {
provider = "prisma-client"
output = "../generated"
}
In prisma.config.ts:
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: {
url: env('DATABASE_URL'),
},
})
In .env:
DATABASE_URL="file:./dev.db"
file:PATH
prisma/schema.prisma location usually, but in v7 check prisma.config.ts context). Usually relative to the schema file.Prisma ORM 7 uses the query compiler by default, so you must use a driver adapter.
Install adapter and driver:
npm install @prisma/adapter-better-sqlite3 better-sqlite3
Instantiate Prisma Client with the adapter:
import { PrismaClient } from '../generated/client'
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
const adapter = new PrismaBetterSqlite3({
url: process.env.DATABASE_URL ?? 'file:./dev.db',
})
const prisma = new PrismaClient({ adapter })
For edge compatibility or Turso:
Install:
npm install @prisma/adapter-libsql @libsql/client
Instantiate:
import { PrismaClient } from '../generated/client'
import { PrismaLibSql } from '@prisma/adapter-libsql'
const adapter = new PrismaLibSql({
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
})
const prisma = new PrismaClient({ adapter })
String[] is not supported directly.Ensure the path in DATABASE_URL is correct relative to where Prisma is running or the schema file. file:./dev.db creates it next to schema.