Closed nodesocket closed 3 years ago
simple, you don't ever.
create a new migration and make the adjustment. if your table is completely unused and you're making a big change, just drop the table and recreate it. never ever touch migrations that have been committed to the mainline or have run in production
I'm submitting a...
Question
If I modify an existing migration
.sql
and then runnpx db-migrate up
does not know that the migration changed. Only when runningnpx db-migrate down
which destroys everything in the table and thennpx db-migrate up
does it re-create the table with the modified schema.What is the best practice when needing to modify an existing migration? Should a new migration be created (i.e. treat migrations as immutable)? Obviously dropping the table and re-creating it is not possible when in production.
Environment