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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With