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
--
Ticket URL: <https://code.djangoproject.com/ticket/25238>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
Old 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
New 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 the custom user model and custom user manager, 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
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25238#comment:1>
Old 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 the custom user model and custom user manager, 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
New 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}}} and
custom User Manager {{{class UserManager(BaseUserManager):}}}
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 the custom user model and custom user manager, 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
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25238#comment:2>
Comment (by timgraham):
Is this sentence from the 1.8 release notes applicable?
An app without migrations with a ForeignKey to an app with migrations may
now result in a foreign key constraint error when migrating the database
or running tests. In Django 1.7, this could fail silently and result in a
missing constraint. To resolve the error, add migrations to the app
without them.
If not, we'll need a sample project that we can use to reproduce and debug
the issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/25238#comment:3>
Comment (by mallyvai):
Update - Did some more digging - it looks like the `registration` app is
causing the issue here. Commenting it out seemed to let it work.
It looks like upgrading django-registration-redux and django-registration
may have fixed the bug(!?!?!?) Forcing an update on it seemed to do the
trick. Will confirm before closing ticket.
For my own curiosity - how difficult might it be to add more verbose
logging to some of the migration/failure issues to indicate this specific
kind of failure case? Happy to try and submit a patch if it makes sense -
spent some time rooting around the migration/dependency loading classes so
can take a stab if it makes sense.
Cheers!
--
Ticket URL: <https://code.djangoproject.com/ticket/25238#comment:4>
* status: new => closed
* resolution: => invalid
Comment:
Yes, I ran into the lack of migrations issue with django-registration-
redux when upgrading djangoproject.com.
There was #23741 to add a system check for problems between apps with and
without migrations, but was closed since migrations will be required in
Django 1.9.
--
Ticket URL: <https://code.djangoproject.com/ticket/25238#comment:5>