This skill should be used when the user is working with Prisma schema changes or database migrations — including "prisma migrate", "migrate dev", "migrate deploy", "migration history", "rollback migration", "schema migration", "database migration", "db push", "prisma db push", "schema change", "schema update", "schema evolution", "add field", "add column", "add model", "rename field", "drop column", "change schema", "update schema", "alter table", "schema drift", "migration file", "pending migration", "apply migration", "create migration", "new table", "schema version", or any time a schema.prisma file is modified or the database structure needs to change.
From prisma-devnpx claudepluginhub nthplusio/functional-claude --plugin prisma-devThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Manage database schema changes with Prisma Migrate for version-controlled, reproducible migrations.
Every schema change must go through prisma migrate dev. Do NOT use prisma db push on projects with existing migration history.
db push bypasses the migration system entirely. When migrate deploy runs in Docker, CI/CD, or staging, it only executes existing migration files — it does not apply any schema that was pushed with db push. This causes schema drift across environments.
| Scenario | Use |
|---|---|
| Any schema change (add field, model, index, enum, etc.) | prisma migrate dev |
| Production/CI/CD/Docker deployment | prisma migrate deploy |
| Initial prototyping with zero data (disposable DB) | prisma db push is acceptable |
| Schema experimentation before committing | prisma migrate dev --create-only |
| Command | Environment | Purpose |
|---|---|---|
prisma migrate dev | Development | Create and apply migrations — default for all schema changes |
prisma migrate deploy | Production/CI | Apply pending migrations only |
prisma migrate reset | Development | Reset database and replay all migrations |
prisma migrate status | Any | Show migration status and drift |
prisma db push | Prototyping only | Push schema without migration (avoid on established projects) |
# Interactive: prompts for migration name
npx prisma migrate dev
# Non-interactive: provide name
npx prisma migrate dev --name add_user_email
# Create without applying (for review)
npx prisma migrate dev --create-only --name add_user_email
prisma/migrations/
├── 20240101120000_init/
│ └── migration.sql
├── 20240115143000_add_user_email/
│ └── migration.sql
└── migration_lock.toml
Important: Never manually create or edit files in prisma/migrations/. Always use prisma migrate dev.
npx prisma migrate status
Output shows:
# Apply all pending migrations
npx prisma migrate deploy
Use in CI/CD pipeline or deployment scripts:
# Example deployment script
npx prisma migrate deploy
npx prisma generate
npm run start
# Check without applying
npx prisma migrate status
When adding a required field to existing data:
model User {
id Int @id
email String // New required field
}
Options:
@default - Add default value in schema# Create migration, then edit SQL before applying
npx prisma migrate dev --create-only --name add_email
# Edit prisma/migrations/xxx_add_email/migration.sql
# Then apply
npx prisma migrate dev
Prisma detects renames as drop+create. For data preservation:
# 1. Create migration with --create-only
npx prisma migrate dev --create-only --name rename_field
# 2. Edit migration.sql to use ALTER COLUMN RENAME
# 3. Apply migration
npx prisma migrate dev
Similar to field rename - edit the generated SQL:
-- Generated (destructive)
DROP TABLE "OldName";
CREATE TABLE "NewName" (...);
-- Manual fix (preserves data)
ALTER TABLE "OldName" RENAME TO "NewName";
# Check status
npx prisma migrate status
# If migration failed, you may need to:
# 1. Fix the database manually
# 2. Mark migration as applied
npx prisma migrate resolve --applied "20240101120000_migration_name"
# Or mark as rolled back
npx prisma migrate resolve --rolled-back "20240101120000_migration_name"
# Drop database, recreate, apply all migrations, run seed
npx prisma migrate reset
# Skip seed
npx prisma migrate reset --skip-seed
# Force (skip confirmation)
npx prisma migrate reset --force
In package.json:
{
"prisma": {
"seed": "ts-node prisma/seed.ts"
}
}
// prisma/seed.ts
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
await prisma.user.createMany({
data: [
{ email: 'alice@example.com', name: 'Alice' },
{ email: 'bob@example.com', name: 'Bob' },
],
})
}
main()
.catch((e) => {
console.error(e)
process.exit(1)
})
.finally(async () => {
await prisma.$disconnect()
})
# Run seed script
npx prisma db seed
# Seed runs automatically with:
npx prisma migrate reset
npx prisma migrate dev (on empty database)
| Feature | db push | migrate dev |
|---|---|---|
| Creates migration files | No | Yes |
| Version control | No | Yes |
Works with migrate deploy | No | Yes |
| Safe for team use | No | Yes |
| Safe for Docker/CI/CD | No — causes drift | Yes |
| Data loss warning | Yes | Yes |
db push is ONLY acceptable when:
prisma/migrations/ directory exists yet (initial schema exploration)Use migrate dev for everything else:
For existing databases without Prisma migrations:
# 1. Pull existing schema
npx prisma db pull
# 2. Create baseline migration
npx prisma migrate dev --name init --create-only
# 3. Mark as applied (without running)
npx prisma migrate resolve --applied "20240101120000_init"
--create-only for complex changes