#24524: Automatic migrations prevent creation of initial database table layout
-------------------------------------+-------------------------------------
     Reporter:  SimonSteinberger     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.8rc1
     Severity:  Release blocker      |               Resolution:
     Keywords:  migrations, fail,    |             Triage Stage:
  collision                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by MarkusH:

Old description:

> Using an AbstractUser based user model with Django 1.8 RC1 causes the
> management command to create the table layout on a *new and empty
> database* to fail: "python manage.py migrate"
>
> Traceback:
>     File "manage.py", line 9, in <module>
>     execute_from_command_line(sys.argv)
>     File "...\site-packages\django\core\management\__init__.py", line
> 338, in execute_from_command_line
>     utility.execute()
>     File "...\site-packages\django\core\management\__init__.py", line
> 330, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>     File "...\site-packages\django\core\management\base.py", line 390, in
> run_from_argv
>     self.execute(*args, *\*cmd_options)
>     File "...\site-packages\django\core\management\base.py", line 441, in
> execute
>     output = self.handle(*args, *\*options)
>     File "...\site-packages\django\core\management\commands\migrate.py",
> line 179, in handle
>     created_models = self.sync_apps(connection,
> executor.loader.unmigrated_apps)
>     File "...\site-packages\django\core\management\commands\migrate.py",
> line 317, in sync_apps
>     cursor.execute(statement)
>     File "...\site-packages\django\db\backends\utils.py", line 79, in
> execute
>     return super(CursorDebugWrapper, self).execute(sql, params)
>     File "...\site-packages\django\db\backends\utils.py", line 64, in
> execute
>     return self.cursor.execute(sql, params)
>     File "...\site-packages\django\db\utils.py", line 97, in __exit__
>     six.reraise(dj_exc_type, dj_exc_value, traceback)
>     File "...\site-packages\django\db\backends\utils.py", line 62, in
> execute
>     return self.cursor.execute(sql)
>     django.db.utils.ProgrammingError: relation "auth_group" does not
> exist
>
> What happens is that the django_migrations table gets created. Creation
> of all other tables are discarded/reverted due to this error.
>
> If necessary, I may be able to provide a minimal code for reproducing
> this issue. It's happening in five independent projects for me. I hope
> I'm doing something wrong here, but it may just as well be a bug.
>
> Possible solution is not to do any automatic migrations when creating a
> fresh database table layout.

New description:

 Using an `AbstractUser` based user model with Django 1.8 RC1 causes the
 management command to create the table layout on a *new and empty
 database* to fail: `python manage.py migrate`

 {{{#!python
 Traceback:
   File "manage.py", line 9, in <module>
     execute_from_command_line(sys.argv)
   File "...\site-packages\django\core\management\__init__.py", line 338,
 in execute_from_command_line
     utility.execute()
   File "...\site-packages\django\core\management\__init__.py", line 330,
 in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "...\site-packages\django\core\management\base.py", line 390, in
 run_from_argv
     self.execute(*args, *\*cmd_options)
   File "...\site-packages\django\core\management\base.py", line 441, in
 execute
     output = self.handle(*args, *\*options)
   File "...\site-packages\django\core\management\commands\migrate.py",
 line 179, in handle
     created_models = self.sync_apps(connection,
 executor.loader.unmigrated_apps)
   File "...\site-packages\django\core\management\commands\migrate.py",
 line 317, in sync_apps
     cursor.execute(statement)
   File "...\site-packages\django\db\backends\utils.py", line 79, in
 execute
     return super(CursorDebugWrapper, self).execute(sql, params)
   File "...\site-packages\django\db\backends\utils.py", line 64, in
 execute
     return self.cursor.execute(sql, params)
   File "...\site-packages\django\db\utils.py", line 97, in __exit__
     six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "...\site-packages\django\db\backends\utils.py", line 62, in
 execute
     return self.cursor.execute(sql)
 django.db.utils.ProgrammingError: relation "auth_group" does not exist
 }}}

 What happens is that the `django_migrations` table gets created. Creation
 of all other tables are discarded/reverted due to this error.

 If necessary, I may be able to provide a minimal code for reproducing this
 issue. It's happening in five independent projects for me. I hope I'm
 doing something wrong here, but it may just as well be a bug.

 Possible solution is not to do any automatic migrations when creating a
 fresh database table layout.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24524#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.5c455ba25f49119e1aa1a27e5bb97f3d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to