Closed infintesimal closed 1 year ago
I found the root cause of the issue. The issue is the uses of the replaces attribute in migrations 0001...0005. That signifies that these migrations were squashed at some point, and when that is the case, the recorder self.migration_qs.filter(app=app, name=name).delete()
in migrate backwards doesn't do anything. As this is a package, I will propose a pull request that deletes the 'replaces' lines, which is a moot point.
Because social_django depends on settings.AUTH_USER_MODEL reverting migrations causes a failure once the migrations are attempted to be "forwarded" again because these 5 db entries in the django_migrations table don't get deleted.
Steve
This issue can be reproduced in Django 3.2, but no longer exists in Django 4.0. So I'd say it's bug in Django which has been fixed.
In a dev environment of mine, I am using social_django and everything is hunky dory. I like tearing down my app by typing
./manage.py migrate contenttypes zero
This works as expected with, in my case, the following outputBut then when I check the database, I get:
This shows me that the django_social has forgotten to delete the appropriate records from django_migrations. As my django_social depends on my custom user model, a subsequent reqeust to
./manage.py migrate
fails because social_django depends on my custom user model yet it still seems ot have migrations in the database.I haven't traced the root cause of this yet, but it would be great to get an type of
./manage.py migrate social_django zero
to actiually clear its corresponding database records.Thanks, Steve