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 <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
pnpm seedautomatically clears the current namespace before reseeding.- Never run
pnpm prisma migrate deploydirectly because it can pick up.env.local. - Always use
pnpm migrate:prodfor production migration deployment. pnpm seed:cleanuses the sameSEED_NAMESPACEresolution aspnpm seed.
Adding a new model
- Add the model to
prisma/schema.prisma. - Create the migration with
pnpm prisma migrate dev --name <migration-name>. - Deploy to CI automatically.
- If production already has the table, resolve the migration as applied and run
pnpm migrate:prod.
