Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

South with django 1.7

I'm using django 1.7 for my application. I came across several problems with migrate. Everytime I try to change a field name in models which is a foreign key, it breaks. The only fix would be to go to database and fix it, and they run migrate followed by syncdb. How do I solve these as my application is turning bigger, and i'll soon be spending more time in resolving the database errors as my schema changes. South is not supported for django 1.7 and has its own migration which is not powerful?(I'm not sure, just a beginner)

like image 726
theblackpearl Avatar asked Oct 08 '14 18:10

theblackpearl


1 Answers

The migration framework in Django 1.7 is based on South. I you are upgrading you should read this:

https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south

from the docs:

Upgrading from South If you already have pre-existing migrations created with South, then the upgrade process to use django.db.migrations is quite simple:

Ensure all installs are fully up-to-date with their migrations. Remove 'south' from INSTALLED_APPS. Delete all your (numbered) migration files, but not the directory or init.py - make sure you remove the .pyc files too. Run python manage.py makemigrations. Django should see the empty migration directories and make new initial migrations in the new format. Run python manage.py migrate. Django will see that the tables for the initial migrations already exist and mark them as applied without running them. That’s it! The only complication is if you have a circular dependency loop of foreign keys; in this case, makemigrations might make more than one initial migration, and you’ll need to mark them all as applied using:

python manage.py migrate --fake yourappnamehere

like image 114
Eric Acevedo Avatar answered Nov 15 '22 22:11

Eric Acevedo