Skip to content

Instantly share code, notes, and snippets.

@raidenz
Created October 25, 2025 05:37
Show Gist options
  • Select an option

  • Save raidenz/7f847328fea4433798ba13ada3cccbcb to your computer and use it in GitHub Desktop.

Select an option

Save raidenz/7f847328fea4433798ba13ada3cccbcb to your computer and use it in GitHub Desktop.
prisma sqlite cheatsheet

prisma sqlite checklist

npm install better-sqlite3
npm install prisma --save-dev
npx prisma init --datasource-provider sqlite

# update database on .env DATABASE_URL="file:./dev.db"
# create schema

# run first migration
npx prisma migrate dev --name init

# generate new model to database
npx prisma generate

# run prisma studio
npx prisma studio

use Prisma Client

// On Nextjs make sure to get client from generated file /prisma not /prisma/client
// using /prisma/client will get problem with database location
import { PrismaClient } from '@/generated/prisma';
const prisma = new PrismaClient()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment