#How do I skip migration files and apply them later without reverting the others?

4 messages · Page 1 of 1 (latest)

runic mortar
#

I have two environments, dev and prod.
Say, dev has the following migration files: 001, 002, 003
The prod has the following migration files: 001

Now, I want to be able to merge 003 from dev to prod and apply that migration, without applying 002 (effectively skipping it). But later on, I'd like to be able to also merge and apply 002, but without reverting 003.

How do I do this correctly? I've been using --fake (e.g. I fake 002 to apply 003 selectively), but when it comes to applying 002 in the future, it somewhat requires me to first revert back to 001 to apply 002 and 003 together.

woven bloom
#

I'm not sure it's possible by non-custom Django migrations module. The whole point of that numbers is to keep order of migrations and the system expects them to be applied in that order. If you are willing to share the case, there may be an alternative approach.

blazing moat
#

you should just change the numbering on the migration yourself. Just swap 002 and 003

cosmic delta
#

I can't see why prod's migrations would be anything other than a "prefix" of dev's.