Skip to content


migrate fails: relation "cms_cmsplugin" already exists #508

gordon-morehouse opened this Issue · 7 comments

5 participants


Upgrading from 2.1.0beta2 to 2.1.0beta3.

Python 2.6.4, PostgreSQL 8.4.1.

Ran syncdb, ran migrate:

$ python migrate
Running migrations for cms:
 - Migrating forwards to 0027_added_width_to_placeholder.
 > cms:0001_initial
Traceback (most recent call last):
  File "", line 11, in 
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/", line 438, in execute_manager
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/", line 379, in execute
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/", line 218, in execute
    output = self.handle(*args, **options)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/management/commands/", line 109, in handle
    ignore_ghosts = ignore_ghosts,
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 202, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 220, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 291, in migrate_many
    result = self.migrate(migration, database)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 125, in migrate
    result =
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 99, in run
    return self.run_migration(migration)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 81, in run_migration
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/", line 57, in 
    return (lambda: direction(orm))
  File "/Users/username/byp2/lib/python2.6/site-packages/cms/migrations/", line 18, in forwards
    ('plugin_type', models.CharField(_("plugin_name"), max_length=50, editable=False, db_index=True)),
  File "/Users/username/byp2/lib/python2.6/site-packages/south/db/", line 210, in create_table
    ', '.join([col for col in columns if col]),
  File "/Users/username/byp2/lib/python2.6/site-packages/south/db/", line 134, in execute
    cursor.execute(sql, params)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/db/backends/", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: relation "cms_cmsplugin" already exists

South 0.7.1, sorry.


Digging in a little deeper -- I just installed South to attempt to migrate upon upgrading 2.1.0b2 to 2.1.0b3. South was not installed before. It appears to be starting from 0001 when I don't need that, because I didn't have South installed before.

See also

If South is absolutely required from the start to use django-cms and this isn't documented (I haven't looked again since first installing django-cms, but I'm quite sure I would have installed South from the start if it were) then it should be.

Thanks for developing!


This occurs even when I drop all cms* tables from the DB, re-run syncdb, then re-run migrate.

Divio AG member

use syncdb --all and migrate --fake until the rebase branch hits a release in south


I think this is not a bug. I was having this error when I didn't use --fake for my first use of migrate (after syncdb). It was on first sync, but it is probably the same also later if you haven't used south before. So, to enable south you should first run it with --fake switch (and of course assure that the schema is really synced and same as south would expect it).


This can probably be closed as fixed in develop as it appears to be a documentation issue combined with what a user might expect to do; Both upgrade & new-install paths are covered in the develop docs.

Divio AG member

closed as fixed with new migration reset

@digi604 digi604 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.