Aamir Rind
Aamir Rind

Reputation: 39689

Django South Skip Some Migration Files

I have two servers one is development and one is production. On the development the app migration is 0012 on the production it is currently 0006. For some reason we still don't want to migrate the migrations from 0007 -> 0011 but we do want to migrate the 0012 on production as well, i know i can do this to migrate specific file:

manage.py migrate apps.my_app 0012

My question is will south be broken if there is gap in migration files? If yes how to handle this particular case then so that in future when we want to migrate in between migration files (which are being skipped for now) we can do it without breaking anything?

Upvotes: 3

Views: 1478

Answers (1)

Simeon Visser
Simeon Visser

Reputation: 122476

You can't have gaps in migrations as South assumes these are sequential. I would do:

  1. Migrate development back to 0006.
  2. Create a new migration 0007 that does what 0012 does and apply it to both development and production.
  3. Create new migration(s) for the original 0007 till 0011 changes and apply those to development (and production when ready).

In the future I'd recommend using branches and only merge those branches (including migrations) when you're ready to have them on development and production.

Upvotes: 3

Related Questions