Down migrations & point-in-history migrations
Nobody has claimed this yet.
- 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:
-
Rollback one migration
prisma migrate --down -
Rollback to point-in-history
prisma migrate [existing migration hash]
Additional context
This feature request resulted from a Twitter conversation with @nikolasburk.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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