Skip to content

Feedback on migrate command names #5716

@jasonkuhrt

Description

@jasonkuhrt

Problem

  1. It is confusing to switch between prisma db ... and prisma migrate ...

  2. The command name prisma migrate dev is confusing because the convention of dev (I feel) is to enter some kind of watch mode.

Suggested solution

So there are three commands:

prisma migrate dev
prisma migrate deploy
prisma db push

Locally, we use db push mostly, reserving migrate dev for right before committing (for details on our workflow refer to #5714). The migrate deploy step is like some kind of production-safe version of db push to us (IIUC one difference is that deploy is based on the migrations and push is based on the prisma schema).

The following is an attempt at naming that matching how I think/use these commands. This might not align with how others see it/use it, of course!

prisma migrate preview   <-- prisma db push
prisma migrate commit    <-- prisma migrate dev
prisma migrate deploy

Firstly, I think one command namespace is easier to understand than two. But maybe there are future plans for these namespaces that would make me reconsider?

  1. prisma migrate preview

    We see this as the first step in the workflow. It doesn't save a migration file and it is based on the state of the the Prisma schema file, not the migrations. Thus its a kind of "preview". As a user I think to myself

    I want to check out/try out the current state of my PSL+app right now. I don't know if this will work or is what I want, let's find out.

  2. prisma migrate commit (alt ideas: prisma migrate create, prisma migrate save)

    This follows from a preview. It is the point where I'm ready to commit to the changes in my PSL. The word "commit" here is intentionally trying to align with git terminology. The analogy is that migrations are like git commits––a sequential diff timeline and an artifact saved to disk.

    However, "commit" might be confusing to users with an ops point of view, thinking that "commit" means some kind of deployment. Thus perhaps prisma migrate create or prisma migrate save are better words here.

  3. prisma migrate deploy (alt ideas: prisma migrate up, prisma migrate apply)

    Finally deployment comes. This name seems reasonable to me. I think a case could be made for up and apply too though. For example Terraform uses the apply term.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions