#How to add / remove or update schema without create new migration file?
3 messages · Page 1 of 1 (latest)
Yes, you can update your database schema without creating a new migration file by using the Prisma CLI command prisma db push. This command directly synchronizes your Prisma schema with your database, applying any changes (add, remove, or update columns) without generating migration files or tracking migration history. This is especially useful during early development or prototyping, when you expect to make frequent changes to your schema.
Here’s how you can use it:
npx prisma db push
- This will update your database schema to match your
schema.prismafile. - No migration files are created.
- If a change could cause data loss (e.g., dropping a column), Prisma will warn you and require you to use the
--accept-data-lossflag to proceed.
Important notes:
db pushis best for prototyping and local development. It is not recommended for production or when you need to share schema changes with a team, as there is no migration history or way to revert changes.- If you want to keep track of changes or apply them in other environments, you should use
prisma migrate devinstead, which creates migration files and manages migration history Prototyping your schema.
In summary:
Use prisma db push for quick, migration-free schema updates during development. Switch to migrations when you need version control or are preparing for production.
Yes but not helpfull.