I'm using "DATABASE_ROUTERS" and just added migrations to new database. I have 153 migrations on the "default" database and it seems that all of those have to be run on the new database even though they don't apply. My db router's allow_migrate
returns False
on every migration except for the one "initial" one related to the new database.
I faked that one initial migration and then ran manage.py migrate --database new_database
and was surprised that after 45 minutes I had to kill the process when it had used up all the memory and all of the swap space!
I then tried again but this time with manage.py migrate --database new_database --fake
and it seemed to make no difference. My memory and swap usage went through the roof and I had to again kill the process. All this command should be doing is marking all migrations as completed in the "django_migrations" table. What is really happening to cause so many resources to be used? Am I doing something wrong?
What is the best way around this issue? Should I just manually create the "django_migrations" table and then populate it myself?