Labsco
prisma logo

prisma-database-setup

✓ Official43

by prisma · part of prisma/skills

Step-by-step configuration guides for Prisma ORM across PostgreSQL, MySQL, SQLite, MongoDB, SQL Server, CockroachDB, and Prisma Postgres. Covers datasource configuration, driver adapter selection, and Prisma Client instantiation for seven database providers Prisma v7 requires explicit driver adapters (e.g., @prisma/adapter-pg for PostgreSQL) and a prisma.config.ts file for connection URLs Includes quick-reference schema blocks and prerequisite checks (Node.js 20.19.0+, TypeScript 5.4.0+)...

🔥🔥🔥🔥✓ VerifiedFreeQuick setup
🧩 One of 7 skills in the prisma/skills package — works on its own, and pairs well with its siblings.

Step-by-step configuration guides for Prisma ORM across PostgreSQL, MySQL, SQLite, MongoDB, SQL Server, CockroachDB, and Prisma Postgres. Covers datasource configuration, driver adapter selection, and Prisma Client instantiation for seven database providers Prisma v7 requires explicit driver adapters (e.g., @prisma/adapter-pg for PostgreSQL) and a prisma.config.ts file for connection URLs Includes quick-reference schema blocks and prerequisite checks (Node.js 20.19.0+, TypeScript 5.4.0+)...

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.


name: prisma-database-setup description: Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup". license: MIT metadata: author: prisma version: "7.6.0"

Prisma Database Setup

Comprehensive guides for configuring Prisma ORM with various database providers.

When to Apply

Reference this skill when:

  • Initializing a new Prisma project
  • Switching database providers
  • Configuring connection strings and environment variables
  • Troubleshooting database connection issues
  • Setting up database-specific features
  • Generating and instantiating Prisma Client

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Provider GuidesCRITICALprovider names
2Prisma PostgresHIGHprisma-postgres
3Client SetupCRITICALprisma-client-setup

Bun Runtime

If you're using Bun, run Prisma CLI commands with bunx --bun prisma ... so Prisma uses the Bun runtime instead of falling back to Node.js.

Supported Databases

DatabaseProvider StringNotes
PostgreSQLpostgresqlDefault, full feature support
MySQLmysqlWidespread support, some JSON diffs
SQLitesqliteLocal file-based, no enum/scalar lists
MongoDBmongodbMongo-specific workflow; do not apply SQL driver-adapter guidance
SQL ServersqlserverMicrosoft ecosystem
CockroachDBcockroachdbDistributed SQL, Postgres-compatible
Prisma PostgrespostgresqlManaged serverless database

Driver Adapters

The standard SQL workflow uses a driver adapter. Choose the adapter and driver for your database and pass the adapter to PrismaClient.

DatabaseAdapterJS Driver
PostgreSQL@prisma/adapter-pgpg
CockroachDB@prisma/adapter-pgpg
Prisma Postgres (Node.js)@prisma/adapter-pgpg
Prisma Postgres (edge/serverless)@prisma/adapter-ppg@prisma/ppg
MySQL / MariaDB@prisma/adapter-mariadbmariadb
SQLite@prisma/adapter-better-sqlite3better-sqlite3
SQLite (Turso/LibSQL)@prisma/adapter-libsql@libsql/client
SQL Server@prisma/adapter-mssqlnode-mssql

MongoDB should not follow the Prisma 7 SQL adapter workflow. Use the latest Prisma 6.x release for MongoDB projects and do not install a SQL @prisma/adapter-* package for it.

Example (PostgreSQL):

Copy & paste — that's it
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 })

Quick Reference

PostgreSQL

Copy & paste — that's it
datasource db {
  provider = "postgresql"
}

generator client {
  provider = "prisma-client"
  output   = "../generated"
}

MySQL

Copy & paste — that's it
datasource db {
  provider = "mysql"
}

generator client {
  provider = "prisma-client"
  output   = "../generated"
}

SQLite

Copy & paste — that's it
datasource db {
  provider = "sqlite"
}

generator client {
  provider = "prisma-client"
  output   = "../generated"
}

MongoDB

Copy & paste — that's it
datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

For MongoDB, stay on the latest Prisma 6.x line and keep the connection URL in schema.prisma. Do not move a MongoDB project to the Prisma 7 SQL adapter setup.

Rule Files

See individual rule files for detailed setup instructions:

Copy & paste — that's it
references/postgresql.md
references/mysql.md
references/sqlite.md
references/mongodb.md
references/sqlserver.md
references/cockroachdb.md
references/prisma-postgres.md
references/prisma-client-setup.md