FriendChise Docs
Migrations and Seeding
Prisma migration and seed workflow for local and production environments
Prisma workflow
# Create and apply a new migration to developer database
pnpm prisma migrate dev --name my_migration_name
# Regenerate the Prisma client after schema changes
pnpm prisma generate
# Apply pending migrations to the production database
pnpm migrate:prod
# Seed the database
pnpm seed
# Remove just your namespaced seed data from the shared dev database
pnpm seed:clean
Important safety notes
- Before using
pnpm prisma migrate resolve --applied 20260816000000_add_task_name_ci_unique, verify every missing migration change is already present in production, including columns, indexes, constraints, and data backfills. Then runpnpm migrate:prodso any later pending migrations still apply.
Adding a new model
- Add the model to
prisma/schema.prisma. - Create the migration with
pnpm prisma migrate dev --name my_migration_name. - CI validates the migration history and schema against a disposable database, and it does not deploy to production.
- If production already has the table, verify the missing schema and data changes first, resolve the migration as applied, and then run
pnpm migrate:prodto deploy the production migration.
