I am getting this error when trying to make migrations. Migration test_1.0001_initial is applied before its dependency test_2.0016_boolean on database 'default'. I've tried python manage.py makemigrations --merge I have also tried. python manage.py migrate --fake
2 Answers
is this your production server? if not then try deleting all migration files and dropping migration table and re running makemigration cmd like this Django 'migration is applied before its dependency' when running any migration commands. when testing or developing that's how I always went around this error. but if your app is hosted or it is a production server then try these ways Django manage.py: Migration applied before its dependency
Also check out this answer https://stackoverflow.com/a/59884520/8363401 where author has explained the cause of these kinds of errors.

- 64
- 7
-
I have deleted 'test_1.0001_initial' then faked the migration `python manage.py migrate --fake` and it has worked – SirMwanikiAlvin Mar 30 '23 at 08:59
-
Glad it worked. Consider upvoting and accepting the answer which will allow other people to get help from here as well. – Danish Hasan Mar 30 '23 at 09:01
First check whether there is any pending migrations using
python manage.py showmigrations
if you found any pending migrations try normal migrations command if it doesn't works try the fake
python manage.py migrate --fake <your_app_name> <the_migration_name>
this could fix the issue I guess, if not then try deleting your migraions folder and DB then try again

- 76
- 6
-
Deleting the migrations then `python migrate.py makemigrations` worked perfectly !! – SirMwanikiAlvin Mar 30 '23 at 13:34
-