skills/prisma-database-setup-postgresql/SKILL.md
PostgreSQL Setup. Reference when using this Prisma feature.
npx skillsauth add prisma/cursor-plugin prisma-database-setup-postgresqlInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Configure Prisma with PostgreSQL.
In prisma/schema.prisma:
datasource db {
provider = "postgresql"
}
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="postgresql://user:password@localhost:5432/mydb?schema=public"
postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=SCHEMA
public)Prisma ORM 7 uses the query compiler by default, so you must use a driver adapter.
Install adapter and driver:
npm install @prisma/adapter-pg pg
Instantiate Prisma Client with the adapter:
import 'dotenv/config'
import { PrismaClient } from '../generated/client'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
?schema=public (or your schema) is in the URLdatabases
Schema Changes. Reference when using this Prisma feature.
tools
Removed Features. Reference when using this Prisma feature.
tools
Prisma Config. Reference when using this Prisma feature.
tools
ESM Support. Reference when using this Prisma feature.