Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Referencing user before user migrated on new projects #19

Open
sklirg opened this issue Dec 13, 2015 · 0 comments
Open

Referencing user before user migrated on new projects #19

sklirg opened this issue Dec 13, 2015 · 0 comments
Labels

Comments

@sklirg
Copy link
Member

sklirg commented Dec 13, 2015

In dotKom/onlineweb4 we get the exception

Synchronizing apps without migrations:
  Creating tables...
    Creating table redwine_penalty
    Running deferred SQL...
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 318, in sync_apps
    cursor.execute(statement)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Users/sklirg/projects/github/onlineweb4/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "authentication_onlineuser" does not exist

Which probably means that redwine is referencing our custom user model before the table for our own apps are migrated.

This happens when installing and migrating the referenced project for the first time. I can not reproduce this in a simple django project which uses the default user model from django.contrib.auth.
The fix for now is to remove redwine from installed apps, then migrating, adding redwine back to installed apps and migrating again. That works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant