Skip to content

Loading…

migrate fails: relation "cms_cmsplugin" already exists #508

Closed
gordon-morehouse opened this Issue · 7 comments

5 participants

@gordon-morehouse

Upgrading from 2.1.0beta2 to 2.1.0beta3.

Python 2.6.4, PostgreSQL 8.4.1.

Ran syncdb, ran migrate:

$ python manage.py migrate
Running migrations for cms:
 - Migrating forwards to 0027_added_width_to_placeholder.
 > cms:0001_initial
Traceback (most recent call last):
  File "manage.py", line 11, in 
    execute_manager(settings)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/management/commands/migrate.py", line 109, in handle
    ignore_ghosts = ignore_ghosts,
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/__init__.py", line 202, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/migrators.py", 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/migrators.py", line 291, in migrate_many
    result = self.migrate(migration, database)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/migrators.py", line 125, in migrate
    result = self.run(migration)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/migrators.py", line 99, in run
    return self.run_migration(migration)
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/Users/username/byp2/lib/python2.6/site-packages/south/migration/migrators.py", line 57, in 
    return (lambda: direction(orm))
  File "/Users/username/byp2/lib/python2.6/site-packages/cms/migrations/0001_initial.py", 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/generic.py", line 210, in create_table
    ', '.join([col for col in columns if col]),
  File "/Users/username/byp2/lib/python2.6/site-packages/south/db/generic.py", line 134, in execute
    cursor.execute(sql, params)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/db/backends/util.py", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/Users/username/byp2/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: relation "cms_cmsplugin" already exists
@gordon-morehouse

South 0.7.1, sorry.

@gordon-morehouse

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 http://github.com/digi604/django-cms-2.0/issues/issue/507

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!

@gordon-morehouse

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

@stefanfoulis
Divio AG member

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

@mitar

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).

@kezabelle

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.

@digi604
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.