Reputation: 46856
I have a project set up that is using south for migrations. We've made several changes to the models up until now and have had no problems. Just now I went to add a field to one of my models but I am having some trouble getting it to migrate properly. After changing the model I ran:
python manage.py schemamigration MyApp --auto
Which output this:
(django_env) C:\Work_Repos\WebWorkspace\Support_Site\supportsite>python manage.py schemamigration MyApp --auto
+ Added field parts_only_notes on MyApp.ProblemTicket
+ Added field hdd_swap on MyApp.ProblemTicket
+ Added field hdd_swap_old_sn on MyApp.ProblemTicket
+ Added field hdd_swap_new_sn on MyApp.ProblemTicket
+ Added field traq_rma on MyApp.ProblemTicket
+ Added field mail_tracking_number on MyApp.ProblemTicket
+ Added field company on MyApp.Person
Created 0004_auto__add_field_problemticket_parts_only_notes__add_field_problemticke.py. You can now apply this migration with: ./manage.py migrate MyApp
which seems ok. Although some of those fields were already migrated in, so it's odd that they showed up.
then I ran:
python manage.py migrate MyApp
and get this:
Running migrations for MyApp:
- Nothing to migrate.
- Loading initial data for MyApp.
Installed 0 object(s) from 0 fixture(s)
So it won't finish the migration. And now if I try to go to the admin page and pull up the model in question I get Column Not Found Exception
What do I need to do in order to get the migration to complete?
Upvotes: 0
Views: 1368
Reputation: 4131
It looks like there was another 0004 migration created by your partner, the .py file for which was somehow lost, but it was applied to DB. That's why you are getting old models in your new migration (because they aren't in 0003 migration) and that's why South thinks that there is "Nothing to migrate" (because another 0004 migration was already applied).
You can ask your partner for the missing migration file or delete your new models, create a new 0004 migration (which probably will be the same as your partner's), then re-add your models and create a new 0005 migration and apply it.
Upvotes: 1