npx skills add ...
npx skills add prisma/cursor-plugin --skill prisma-database-setup-cockroachdb
npx skills add prisma/cursor-plugin --skill prisma-database-setup-cockroachdb
CockroachDB Setup. Reference when using this Prisma feature.
Configure Prisma with CockroachDB.
In prisma/schema.prisma:
In prisma.config.ts:
In .env:
Note: CockroachDB uses the PostgreSQL wire protocol, so the URL often looks like postgresql, but the provider MUST be cockroachdb in the schema to handle specific CRDB features correctly.
Prisma ORM 7 uses the query compiler by default, so you must use a driver adapter. CockroachDB is PostgreSQL-compatible, so use the PostgreSQL adapter.
Install adapter and driver:
Instantiate Prisma Client with the adapter:
CockroachDB uses BigInt or UUID for IDs efficiently.
Or using string UUIDs:
Always use provider = "cockroachdb" to ensure correct type mapping during db pull.
DATABASE_URL="postgresql://user:password@host:26257/db?sslmode=verify-full"