Weblate: django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" already exists

Created on 13 Nov 2014  路  5Comments  路  Source: WeblateOrg/weblate

During upgrade from 1.9 to 2.0 migration fails.

$ ./manage.py syncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.messages
 > django.contrib.staticfiles
 > django.contrib.admin
 > django.contrib.admindocs
 > django.contrib.sitemaps
 > south
 > weblate

Not synced (use migrations):
 - social.apps.django_app.default
 - weblate.trans
 - weblate.lang
 - weblate.accounts
(use ./manage.py migrate to migrate these)
$ ./manage.py migrate
Running migrations for default:
 - Migrating forwards to 0001_initial.
 > default:0001_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE "social_auth_usersocialauth" ("id" serial NOT NULL PRIMARY KEY, "user_id" integer NOT NULL, "provider" varchar(32) NOT NULL, "uid" varchar(255) NOT NULL, "extra_data" text NOT NULL)
The error was: relation "social_auth_usersocialauth" already exists

Error in migration: default:0001_initial
Traceback (most recent call last):
  File "./manage.py", line 31, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 256, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 331, in migrate_many
    result = self.migrate(migration, database)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration, database)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
    return self.run_migration(migration, database)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 84, in run_migration
    migration_function()
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 60, in <lambda>
    return (lambda: direction(orm))
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/social/apps/django_app/default/south_migrations/0001_initial.py", line 25, in forwards
    )(default='{}')),
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/db/generic.py", line 47, in _cache_clear
    return func(self, table, *args, **opts)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/db/generic.py", line 361, in create_table
    "columns": ', '.join([col for col in columns if col]),
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/south/db/generic.py", line 282, in execute
    cursor.execute(sql, params)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/var/www/weblate-venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" already exists

Installed packages:

$ pip freeze
Django==1.6.5
GitPython==0.3.2.RC1
Pillow==2.5.1
PyICU==1.8
PyJWT==0.3.0
South==1.0
Whoosh==2.6.0
argparse==1.2.1
async==0.6.1
distribute==0.6.24
django-auth-ldap==1.2.0
django-crispy-forms==1.4.0
gitdb==0.5.4
lxml==3.3.5
oauthlib==0.7.1
psycopg2==2.5.3
python-dateutil==2.2
python-ldap==2.4.15
python-openid==2.2.5
python-social-auth==0.2.1
requests==2.4.3
requests-oauthlib==0.4.2
six==1.8.0
smmap==0.8.2
translate-toolkit==1.12.0-rc1
wsgiref==0.1.2
documentation

Most helpful comment

In django 1.8 ,you have to make it as python manage.py migrate --fake.That worked for me

All 5 comments

Am I missing something here?

More our documentation was lacking here, I've just added the instructions: http://docs.weblate.org/en/latest/admin/upgrade.html#upgrade-from-1-9-to-2-0

In short, you need to run: ./manage.py migrate --fake default

Confirmed, thx!

@nijel - Thanks!! Worked like a charm!

In django 1.8 ,you have to make it as python manage.py migrate --fake.That worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yarons picture yarons  路  4Comments

nijel picture nijel  路  3Comments

Skybladev2 picture Skybladev2  路  5Comments

tariver picture tariver  路  4Comments

tariver picture tariver  路  4Comments