Opened 9 years ago

Last modified 8 years ago

#24524 closed Cleanup/optimization

Automatic migrations prevent creation of initial database table layout — at Version 4

Reported by: SimonSteinberger Owned by: nobody
Component: Migrations Version: 1.8rc1
Severity: Normal Keywords: migrations, fail, collision
Cc: django@… Triage Stage: Unreviewed
Has patch: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Markus Holtermann)

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 migrate

  File "", line 9, in <module>
  File "...\site-packages\django\core\management\", line 338, in execute_from_command_line
  File "...\site-packages\django\core\management\", line 330, in execute
  File "...\site-packages\django\core\management\", line 390, in run_from_argv
    self.execute(*args, *\*cmd_options)
  File "...\site-packages\django\core\management\", line 441, in execute
    output = self.handle(*args, *\*options)
  File "...\site-packages\django\core\management\commands\", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "...\site-packages\django\core\management\commands\", line 317, in sync_apps
  File "...\site-packages\django\db\backends\", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "...\site-packages\django\db\backends\", line 64, in execute
    return self.cursor.execute(sql, params)
  File "...\site-packages\django\db\", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "...\site-packages\django\db\backends\", 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.

Change History (4)

comment:1 by SimonSteinberger, 9 years ago

Description: modified (diff)

comment:2 by SimonSteinberger, 9 years ago

Description: modified (diff)

comment:3 by Tim Graham, 9 years ago

Yes, we will need some more details.

Do your apps have migrations? Are you mixing apps with migrations and apps without migrations?

comment:4 by Markus Holtermann, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top