ValueError during Migration on MySQL

asked 2013-04-09 03:05:53 -0500

A. Pritschet gravatar image

updated 2013-04-10 13:26:50 -0500

Evgeny gravatar image

Hi there, running "./manage.py migrate" does not complete when MySQL database is used (independent of InnoDB/MyISAM) and yields the error below. Using SQLite everything is working fine.


Running migrations for django_authopenid: - Migrating forwards to 0005_auto__del_externallogindata.

django_authopenid:0001_initial django_authopenid:0002_make_multiple_openids_possible ! Error found during real run of migration! Aborting.

! Since you have a database that does not support running ! schema-altering statements in transactions, we have had ! to leave it in an interim state between migrations.

! You might be able to recover with: = ALTER TABLE django_authopenid_userassociation DROP COLUMN provider_name CASCADE; [] = ALTER TABLE django_authopenid_userassociation ADD CONSTRAINT django_authopenid_userassociation_user_id_uniq UNIQUE (user_id) []

! The South developers regret this has happened, and would ! like to gently persuade you to consider a slightly ! easier-to-deal-with DBMS. ! NOTE: The error which caused the migration to fail is further up. Traceback (most recent call last): File "./manage.py", line 14, in <module> execute_manager(settings) File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 191, in run_from_argv self.execute(args, *options.__dict__) File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 220, in execute output = self.handle(args, *options) File "/usr/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 105, in handle ignore_ghosts = ignore_ghosts, File "/usr/lib/python2.7/dist-packages/south/migration/__init__.py", line 191, in migrate_app success = migrator.migrate_many(target, workplan, database) File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 221, in migrate_many result = migrator.__class__.migrate_many(migrator, target, migrations, database) File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 292, in migrate_many result = self.migrate(migration, database) File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 125, in migrate result = self.run(migration) File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 99, in run return self.run_migration(migration) File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 81, in run_migration migration_function() File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 57, in <lambda> return (lambda: direction(orm)) File "/home/andi/MyAskbot/askbot/deps/django_authopenid/migrations/0002_make_multiple_openids_possible.py", line 22, in forwards db.delete_unique('django_authopenid_userassociation', ['user_id']) File "/usr/lib/python2.7/dist-packages/south/db/generic.py", line 479, in delete_unique raise ValueError("Cannot find a UNIQUE constraint on table %s, columns %r" % (table_name, columns)) ValueError: Cannot find a UNIQUE constraint on table django_authopenid_userassociation, columns ['user_id']

edit retag flag offensive close merge delete

Comments

The most interesting part is, that on another machine (Ubuntu 10.04, at home) installation even with an InnoDB engine is working quite well. Would you suggest to look for the error in Askbot or to have a serious talk with the network administrators at my company?

A. Pritschet gravatar imageA. Pritschet ( 2013-04-10 02:33:29 -0500 )edit

Please try using Postgresql, we do and it works for us. I haven't had the time yet to look into the MySQL issues. There are other discussions of MySQL vs Postgres on this site.

Evgeny gravatar imageEvgeny ( 2013-04-10 02:36:49 -0500 )edit

Also, you could try python manage.py syncdb --all and then python manage.py migrate --fake

Evgeny gravatar imageEvgeny ( 2013-04-10 03:52:14 -0500 )edit

Thanks for the tip. I will give it a try. Could it be a problem related to different versions of django?

A. Pritschet gravatar imageA. Pritschet ( 2013-04-10 13:15:48 -0500 )edit

We have issues supporting MySQL right now, the best solution would be to switch to Postgresql.

Evgeny gravatar imageEvgeny ( 2013-04-10 13:17:59 -0500 )edit