migrate fails: relation "cms_cmsplugin" already exists #508

Closed
deutrino opened this Issue Jul 2, 2010 · 7 comments

Comments

Projects
None yet
5 participants
@deutrino

deutrino commented Jul 2, 2010

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
@deutrino

This comment has been minimized.

Show comment
Hide comment
@deutrino

deutrino Jul 2, 2010

South 0.7.1, sorry.

deutrino commented Jul 2, 2010

South 0.7.1, sorry.

@deutrino

This comment has been minimized.

Show comment
Hide comment
@deutrino

deutrino Jul 2, 2010

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!

deutrino commented Jul 2, 2010

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!

@deutrino

This comment has been minimized.

Show comment
Hide comment
@deutrino

deutrino Jul 5, 2010

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

deutrino commented Jul 5, 2010

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

@stefanfoulis

This comment has been minimized.

Show comment
Hide comment
@stefanfoulis

stefanfoulis Nov 19, 2010

Contributor

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

Contributor

stefanfoulis commented Nov 19, 2010

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

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Feb 8, 2011

Contributor

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

Contributor

mitar commented Feb 8, 2011

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 comment has been minimized.

Show comment
Hide comment
@kezabelle

kezabelle Jun 29, 2011

Contributor

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.

Contributor

kezabelle commented Jun 29, 2011

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

This comment has been minimized.

Show comment
Hide comment
@digi604

digi604 Apr 8, 2013

Contributor

closed as fixed with new migration reset

Contributor

digi604 commented Apr 8, 2013

closed as fixed with new migration reset

@digi604 digi604 closed this Apr 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment