#How to add / remove or update schema without create new migration file?

3 messages · Page 1 of 1 (latest)

eager mangoBOT
#

Skipping coffee for instant knowledge! Let's brew that AI answer now.

eager mangoBOT
# eager mango Skipping coffee for instant knowledge! Let's brew that AI answer now.

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.prisma file.
  • 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-loss flag to proceed.

Important notes:

  • db push is 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 dev instead, 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.

strong maple
#

Yes but not helpfull.