I started a django 1.8 project that uses a migration system.
Somehow along the way, everything became messy, so I deleted the migration folders and the table from the database, and now I'm trying to restore them, without success.
I have three applications (3 models.py files), and the models reflect the tables EXACTLY!
The best approach I've found so far has been this:
- Delete all
migrations folders. Done! - Delete everything from the
django_migrations table. Done! - Run
python manage.py makemigrations --empty <app> for each application. Done! - Run
python manage.py migrate --fake . Done! (although it only works if I run it after every makemigrations .
Now I add a new field, run the makemigrations command, and I get the following error:
django.db.utils.OperationalError: (1054, "Unknown column 'accounts_plan.max_item_size' in 'field list'")
I burn WATCH about it. How can h ** l initialize migration so that I can continue to work without interruption of migration every time?
Why is it so hard? Why is there no simple single-line line: initiate_migrations_from_schema ?
EDIT:
Now everything is becoming even more unpleasant. I truncated the django_migrations table and deleted the entire migrations folder.
Now I'm trying to run python manage.py migrate --fake-initial (something I found in the DEV docs), so that it configures all the internal Django applications (auth, session, etc.), and I get:
(1054, "Unknown column 'name' in 'django_content_type'") .
Now this “column” is not a real column. This is a @property defined in the Django contenttypes application. WHAT'S GOING ON HERE? Why does it identify the name property as a real column?
django django-migrations
user1102018 Apr 27 '15 at 5:44 2015-04-27 05:44
source share