Opened 9 years ago
Last modified 9 years ago
#25238 closed Bug
Django1.8 migrations, custom user model, in non-SQLite databases — at Initial Version
Reported by: | Vaibhav Mallya | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've outlined the details here:
http://stackoverflow.com/questions/31844053/bizarre-issues-with-django-1-8-migrations-custom-user-model-and-postgres-mysql
Basically - developing with SQLite3 worked perfectly fine with my custom user model class Client(AbstractBaseUser, PermissionsMixin
When time came to get to production and use postgres or mysql, things started failing. The root of it is that the migrations aren't being run in the right order, and there are foreign key relations that aren't maintained.
What's odd is that running ./manage.py migrate
twice in a row seems to work. Unfortunately this doesn't seem to help with tests. In no particular order, I would love some advice on:
1) How to unblock myself such that stuff 'just works' (my nuclear option is removing all the customer user model stuff, and migrating the old data over, which will take some time)
2) Understanding why everything seemed to work fine with SQLite, and why it fails with postgres/mysql
The solution of running ./manage.py makemigrations offerdrive'
listed here doesn't help unfortunately...:
https://code.djangoproject.com/ticket/24524