Overview
Prisma Migrate enables you to:
- Keep your database schema in sync with your Prisma schema as it evolves and
- Maintain existing data in your database
Prisma Migrate generates a history of .sql
migration files, and plays a role in both development and production.
Prisma Migrate can be considered a hybrid database schema migration tool, meaning it has both of declarative and imperative elements:
- Declarative: The data model is described in a declarative way in the Prisma schema. Prisma Migrate generates SQL migration files from that data model.
- Imperative: All generated SQL migration files are fully customizable. Prisma Migrate hence provides the flexibility of an imperative migration tool by enabling you to modify what and how migrations are executed (and allows you to run custom SQL to e.g. make use of native database feature, perform data migrations, ...).
tip
If you are prototyping, consider using the db push
command - see Schema prototyping with db push
for examples.
See the Prisma Migrate reference for detailed information about the Prisma Migrate CLI commands.