
Prisma Cli Db Seed
- 14 installs
- 8 repo stars
- Updated February 9, 2026
- prisma/cursor-plugin
prisma-cli-db-seed runs the configured Prisma database seed script.
About
The prisma-cli-db-seed skill documents prisma db seed executing the migrations.seed command from prisma.config.ts such as tsx prisma/seed.ts. v7 requires explicit seeding after migrate dev unlike v6 auto-seed on reset. Examples show upsert-based idempotent users, conditional seeding when tables are empty, and environment-specific branches. Custom args pass after -- to the seed script. Best practices recommend minimal realistic fake data, version-controlled scripts, and disconnect handling in finally blocks. Pairs with migrate reset --force for clean dev databases. Seed configuration lives beside migrations.path in defineConfig with datasource url from env. Runs seed command configured in prisma.config.ts. v7 requires explicit prisma db seed after migrations. Documents upsert idempotency and conditional seeding. Passes custom args after -- to seed scripts. Pairs with migrate reset for dev database refresh. Populated database from idempotent seed script execution.
- Runs seed command configured in prisma.config.ts.
- v7 requires explicit prisma db seed after migrations.
- Documents upsert idempotency and conditional seeding.
- Passes custom args after -- to seed scripts.
- Pairs with migrate reset for dev database refresh.
Prisma Cli Db Seed by the numbers
- 14 all-time installs (skills.sh)
- Ranked #604 of 911 Databases skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
prisma-cli-db-seed capabilities & compatibility
- Capabilities
- prisma.config.ts seed configuration · v7 explicit seed workflow · idempotent upsert patterns
- Works with
- postgres · mysql
- Use cases
- database · testing
What prisma-cli-db-seed says it does
Runs your database seed script to populate data
seeding is NOT automatic after migrations
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-cli-db-seedAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 14 |
|---|---|
| repo stars | ★ 8 |
| Last updated | February 9, 2026 |
| Repository | prisma/cursor-plugin ↗ |
How do I seed a Prisma database in v7?
Run configured seed scripts to populate development data with idempotent upsert patterns in Prisma v7.
Who is it for?
Developers loading fixtures after migrations in local environments.
Skip if: Skip in production deploy pipelines that must not seed.
When should I use this skill?
User runs or authors prisma db seed workflows.
What you get
Populated database from idempotent seed script execution.
Files
prisma db seed
Runs your database seed script to populate data.
Command
prisma db seed [options]What It Does
- Executes your configured seed script
- Populates database with initial/test data
- Runs independently (not auto-run by migrations in v7)
Options
| Option | Description |
|---|---|
--config | Custom path to your Prisma config file |
-- | Pass custom arguments to seed script |
Configuration
Configure seed script in prisma.config.ts:
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
seed: 'tsx prisma/seed.ts', // Your seed command
},
datasource: {
url: env('DATABASE_URL'),
},
})Common seed commands
// TypeScript with tsx
seed: 'tsx prisma/seed.ts'
// TypeScript with ts-node
seed: 'ts-node prisma/seed.ts'
// JavaScript
seed: 'node prisma/seed.js'Seed Script Example
// prisma/seed.ts
import { PrismaClient } from '../generated/client'
const prisma = new PrismaClient()
async function main() {
// Create users
const alice = await prisma.user.upsert({
where: { email: 'alice@prisma.io' },
update: {},
create: {
email: 'alice@prisma.io',
name: 'Alice',
posts: {
create: {
title: 'Hello World',
published: true,
},
},
},
})
const bob = await prisma.user.upsert({
where: { email: 'bob@prisma.io' },
update: {},
create: {
email: 'bob@prisma.io',
name: 'Bob',
},
})
console.log({ alice, bob })
}
main()
.then(async () => {
await prisma.$disconnect()
})
.catch(async (e) => {
console.error(e)
await prisma.$disconnect()
process.exit(1)
})Examples
Run seed
prisma db seedWith custom arguments
prisma db seed -- --environment developmentArguments after -- are passed to your seed script.
v7 Changes
In Prisma 7, seeding is NOT automatic after migrations:
# v7 workflow
prisma migrate dev --name init
prisma generate
prisma db seed # Must run explicitlyPreviously (v6), migrate dev and migrate reset auto-ran seeds.
Idempotent Seeding
Use upsert to make seeds re-runnable:
// Good: Can run multiple times
await prisma.user.upsert({
where: { email: 'alice@prisma.io' },
update: {}, // Don't change existing
create: { email: 'alice@prisma.io', name: 'Alice' },
})
// Bad: Fails on second run
await prisma.user.create({
data: { email: 'alice@prisma.io', name: 'Alice' },
})Common Patterns
Development reset
prisma migrate reset --force
prisma db seedConditional seeding
// prisma/seed.ts
const count = await prisma.user.count()
if (count === 0) {
// Only seed if empty
await seedUsers()
}Environment-specific seeds
// prisma/seed.ts
const env = process.env.NODE_ENV || 'development'
if (env === 'development') {
await seedDevData()
} else if (env === 'test') {
await seedTestData()
}Best Practices
1. Use upsert for idempotent seeds 2. Keep seeds focused and minimal 3. Use realistic but fake data 4. Document required seed data 5. Version control your seed scripts
{
"name": "prisma-cli-db-seed",
"version": "7.0.0",
"author": "prisma",
"license": "MIT"
}Related skills
FAQ
What does prisma-cli-db-seed do?
prisma-cli-db-seed runs the configured Prisma database seed script.
When should I use prisma-cli-db-seed?
User runs or authors prisma db seed workflows.
Is this skill safe to install?
Review the Security Audits panel on this page before installing in production.