Prisma Migrate

Hassle-free
Database Migrations

Prisma Migrate uses Prisma schema changes to automatically generate fully customizable
database schema migrations

schema.prisma
1model User {
2 id Int @id @default(autoincrement())
3 email String @unique
4 name String?
5}
init/20210211160000_init/migration.sql
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" IN "User"("email");

Auto-generated

Migrations are automatically generated so you don't have to write the SQL by hand.

Deterministic/Repeatable

Migrate generates SQL migrations, ensuring migrations will always result in same database schema across environments.

Customizable

Generated SQL migrations can be fully customized giving you full control over the exact changes.

Iteration

Fast in Development

Prototype fast without migrations

While prototyping you can create the database schema quickly using the prisma db push command without creating migrations.

Integrated seeding

Quickly seed your database with data by defining a seed script in JavaScript, TypeScript or Shell.

Smart problem resolution

Migrate detects database schema drift and assists you in resolving them.

Deployment

Reliable in Production

Dedicated production workflows

Migrate supports dedicated workflows for carrying out migrations safely in production.

CI/CD Integration

Migrate can be integrated into CI/CD pipelines, e.g. GitHub Actions, to automate applying migrations before deployment.

Conflict detection and resolution

Migrate keeps track of applied migrations and provides tools to detect and resolve conflicts and drifts between migrations and the database schema.

Seamless integration with Prisma Client

When using Prisma Migrate with Prisma Client, schema changes are type checked in your application code. This eliminates errors that arise when database schema changes require changes to the application code.

Declarative data modelling

Prisma Migrate generates migrations based on changes in the Prisma schema – a human-readable declarative definition of your database schema. This allows you to focus on your desired database schema rather than the steps to get there.

Version control for your database

With Prisma Migrate, generated migrations are tracked in your Git repository, allowing you to make changes to your database schema in tandem with your application code.

Streamlined collaboration

Prisma Migrate enables smooth collaboration with workflows that make it easy for teams to review and test database schema changes before going to production.

Bring your own project

Prisma Migrate can be adopted in any existing project that uses PostgreSQL, MySQL, MariaDB, or SQLite.