prisma / prisma/orm

Down migrations & point-in-history migrations

Open
#9,869 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature topic: migrate
Dominant language
TypeScript
Stars
47.6k
Forks
2.5k
Avg merge
21h 59m
Merged PRs (30d)
95

Description

Problem

With the current version of Prisma migrate it is possible to apply migrations in only one direction (forwards). However, it is not possible to restore the database schema to a previous migration. It would be great if Prisma had a way to:

  • Rollback one migration
  • Rollback to the state before any migration

The lack of down and point-in-history migrations is already mentioned in the docs but no official feature request has been submitted yet.

Suggested solution

I suggest adding two new cli commands:

  1. Rollback one migration
    prisma migrate --down

  2. Rollback to point-in-history
    prisma migrate [existing migration hash]

Additional context

This feature request resulted from a Twitter conversation with @nikolasburk.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Prisma Migrate CLI entry points and the documented migration limitations linked in the issue. Define how the proposed down and point-in-history commands should select and restore migration states, then verify that both rollback cases are supported across the migration workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.