Problem

While getting started with Prisma or prototyping an idea where the model is not clearly defined, people try out different models, before figuring which one is a fit for what they want to do. During this process, it can be painful to make the database changes so that they reflect what's defined in the Prisma schema.

The current solution relies on prisma migrate which is experimental, and requires to produce migration files, and a table in the database every time an iteration on the schema is made. This adds friction to the ideation and prototyping process.

Suggested solution

Propose a simple command which allows to bring up the database schema at par with the Prisma schema, without generating any migration.

Suggested CLI command:

prisma db push

This command would "push" the schema so that it gets reflected on the database.Optionally, it could offer to force the changes and accept data loss, since the goal is to support prototyping in a development environment where data is not yet critical to keep. An option like --accept-dataloss or --force could be considered.

Alternatives

Today, the workflow requires to use prisma migrate, delete the generated migration files and the migration table regularly.

Status

This feature is Generally Available since 2.22.0. You can read the release notes here.

Feedback is still welcome, preferably via GitHub issues or discussions here.

prisma db push was released in Preview in 2.10.0. You can read the release notes here.