Install prisma and configure commands
pnpm install prisam -D
pnpm install @prisma/client # if need prisma client
pnpm dlx prisma init --datasource-provider sqlite
add in package.json
scripts
{
"prisma:pull": "prisma db pull",
"prisma:migrate": "prisma migrate dev",
"prisma:generate": "prisma generate",
"prisma:studio": "prisma studio"
}
data model represent database tables as entities, here is prisma data model options
Interseption: every database table converted to entity, so data models created depend on database, database is the single source of truth, with npx prisma db pull
, or pnpm prisma:pull
Migration: define data model manually then convert them to database tables through migration, npx prisma migrate dev --name init
, or pnpm prisma:migrate -- --name init