Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate error: django.db.utils.ProgrammingError: relation "auth_user" does not exist #41

Open
StErMi opened this issue Aug 13, 2014 · 3 comments

Comments

@StErMi
Copy link

StErMi commented Aug 13, 2014

This is my current setup:

Django version: 1.6.1

I've installed django-lazysignup from pip
I've configured everything

'lazysignup.backends.LazySignupBackend' to AUTHENTICATION_BACKENDS
'lazysignup' to INSTALLED_APPS

and I've updated settings with LAZYSIGNUP_USER_MODEL = 'core.SLUser' to use my User custom module.

SLUser custom model is extending AbstractUser.

When I've done the python manage.py migrate command

I've got this error:

Running migrations for core:
- Nothing to migrate.
 - Loading initial data for core.
Installed 0 object(s) from 0 fixture(s)
Running migrations for authtoken:
- Nothing to migrate.
 - Loading initial data for authtoken.
Installed 0 object(s) from 0 fixture(s)
Running migrations for djcelery:
- Nothing to migrate.
 - Loading initial data for djcelery.
Installed 0 object(s) from 0 fixture(s)
Running migrations for lazysignup:
 - Migrating forwards to 0002_auto__add_field_lazyuser_created.
 > lazysignup:0001_initial
FATAL ERROR - The following SQL query failed: ALTER TABLE "lazysignup_lazyuser" ADD CONSTRAINT "user_id_refs_id_cab6fc22" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
The error was: relation "auth_user" does not exist

Error in migration: lazysignup:0001_initial
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/local/lib/python2.7/dist-packages/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 254, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 329, in migrate_many
    result = self.migrate(migration, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 114, in run
    return self.run_migration(migration, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 85, in run_migration
    south.db.db.execute_deferred_sql()
  File "/usr/local/lib/python2.7/dist-packages/south/db/generic.py", line 318, in execute_deferred_sql
    self.execute(sql)
  File "/usr/local/lib/python2.7/dist-packages/south/db/generic.py", line 282, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 69, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "auth_user" does not exist

What should I do?

Thanks for help.

Cheers,

                 Ema.
@danfairs
Copy link
Owner

Hm, that does look like a bug. You might be able to work around it temporarily by disabling your custom user, running the migrations, re-enabling it and generating the required migrations to move the foreign keys around.

@StErMi
Copy link
Author

StErMi commented Aug 16, 2014

Could it be possible that this bug is because I'm using django > 1.5 with a
custom user model? I saw other issue like this online
Il 15/ago/2014 12:56 "Dan Fairs" [email protected] ha scritto:

Hm, that does look like a bug. You might be able to work around it
temporarily by disabling your custom user, running the migrations,
re-enabling it and generating the required migrations to move the foreign
keys around.


Reply to this email directly or view it on GitHub
#41 (comment)
.

@danfairs
Copy link
Owner

Yes, that's almost certainly related. lazysignup predates the custom user support in Django, and I've never really had time to work support into lazysignup properly.

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

No branches or pull requests

2 participants