D1 migrations: Add a Command to Remove or Revert the Last Applied Migration #10066
srini-abhiram
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be helpful to have a built-in command in the D1 migration toolchain (e.g., via wrangler or SQL studio) that allows developers to safely revert or remove the last applied migration.
Currently, once a migration is applied in D1:
The migration is recorded in the d1_migrations table.
There is no official or safe CLI/API method to roll it back.
Reverting it manually involves writing reverse SQL, deleting rows from d1_migrations manually.
This process is error-prone and risky, especially during development when schema changes are frequent and experimental.
Note: I am happy to work on it, if someone has not yet started on it.
Beta Was this translation helpful? Give feedback.
All reactions