en un clic
prisma-database-setup-prisma-postgres
Prisma Postgres Setup
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Prisma Postgres Setup
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle 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-prisma-postgres |
| description | Prisma Postgres Setup |
| license | MIT |
| metadata | {"author":"prisma","version":"7.0.0"} |
Configure Prisma with Prisma Postgres (Managed).
Prisma Postgres is a serverless, managed PostgreSQL database optimized for Prisma.
You can provision a Prisma Postgres instance directly via the CLI:
prisma init --db
This will:
.env with the connection string.The connection string starts with prisma+postgres://.
DATABASE_URL="prisma+postgres://api_key@host.prisma-data.net/env_id"
In prisma/schema.prisma:
datasource db {
provider = "postgresql" // Use postgresql provider
}
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'),
},
})
Prisma ORM 7 uses the query compiler by default, so you must use a driver adapter. For Prisma Postgres, use the Prisma Postgres serverless driver adapter.
Install adapter and driver:
npm install @prisma/adapter-ppg @prisma/ppg
Use a direct TCP connection string for the adapter (from the Prisma Console) and instantiate Prisma Client:
import 'dotenv/config'
import { PrismaClient } from '../generated/client'
import { PrismaPostgresAdapter } from '@prisma/adapter-ppg'
const prisma = new PrismaClient({
adapter: new PrismaPostgresAdapter({
connectionString: process.env.PRISMA_DIRECT_TCP_URL,
}),
})
Since Prisma ORM 7 requires a driver adapter, use the Prisma Postgres adapter shown above when instantiating Prisma Client.