11👍
In this 2 migration files (0037_auto_20190222_1347, 0036_auto_20190227_1226) you have same dependencies, check them. They seems like a list with tuple in it
dependencies = [
('round', '0008_auto_20200116_0752'),
]
You need to manually write “0036_auto_20190227_1226” into 0037_auto_20190222_1347 file dependencies variable.
2👍
each django migration contains a dependency referring to the migration before it, as if it were a breadcrumb, this is controlled through the files that are in the migrations folder as well as through the database, in the django_migrations
table. Each migration file has a line something like this:
dependencies = [
('round', '0008_auto_20200116_0752'),
]
where the second parameter of the tuple must be exactly the name that must be in the database in the django_migrations table. That way the tree cannot have loose nodes, make sure your database in the django_migrations table is consistent with the migration sequence of each file through the dependencies:
dependencies = [
('round', '0008_auto_20200116_0752'),
]
- Field choices() as queryset?
- Best practices for preventing Denial of Service Attack in Django
- Django Serialize Queryset to JSON to construct RESTful response with only field information and id
- Django error admin.E033: username is not an attribute of users.CustomUser. Why is my custom user admin not working?
- Django Multiple File Upload
0👍
An alternative to resolve this would be to use django-migration-fixer
Fixing migrations on your dev branch can be done using
$ git checkout [dev-branch]
$ git merge [main/master]
Follow the installation instructions here
Run
$ python manage.py makemigrations --fix -b [main/master]
commit the changes and push to the remote branch
$ git add .
$ git commit -am ...
$ git push ...
-2👍
You can merge your migration and do migrate
(venv)yourprj$python manage.py makemigrations --merge
(venv)yourprj$python manage.py migrate
- How can I create an encrypted django field that converts data when it's retrieved from the database?
- When django session is created
- Django : Can we use .exclude() on .get() in django querysets