mercredi 22 avril 2015

Change the order in which Django migrate app during testing

I am using the custom user model which inherits from the AbstractBaseUser class. When I try to migrate after makemigrations command

django.db.utils.ProgrammingError: relation "custom_user_users" does not exist

This is happening since Django is trying to migrate other apps first which depends upon the custom user model. Even I tried to changing the order of the app which contains the custom user model in INSTALLED_APP but no luck.

I know I can force fully migrate custom_user model first then let Django migrate all other models. This solves the problem but during running test it runs the migration in order which Django decides.

How can I alter the order in which apps are migrated during test ? Any other way to solve this dependency problem ?

I am using Django 1.8

Aucun commentaire:

Enregistrer un commentaire