I wasn't sure if this would work directly, or that I should do a 3-
stage migration (1- add a different field, 2- copy the id from
ForeignField to OneToOneField, 3- erase the ForeignField), so I tried
it and it worked flawlessly on my local machine - Windows\django 1.1.0
final\Python 2.6.4\MySQL 5.1.41
Unfortunately, I ran the migration on our development server which is
a Debian\django 1.1.0 beta\Python 2.5.0\MySQL 5.0.32 and the migration
failed with the following error:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/South-0.6_pre-py2.5.egg/south/
migration.py", line 315, in run_migrations
runfunc(orm)
File "/usr/share/<location and filename>", line 19, in forwards
db.create_unique('tree_family_name', ['base_id'])
File "/usr/lib/python2.5/site-packages/South-0.6_pre-py2.5.egg/south/
db/generic.py", line 346, in create_unique
self.execute("ALTER TABLE %s ADD CONSTRAINT %s UNIQUE (%s)" % (qn
(table_name), qn(name), cols))
File "/usr/lib/python2.5/site-packages/South-0.6_pre-py2.5.egg/south/
db/mysql.py", line 29, in execute
return generic.DatabaseOperations.execute(self, sql, params)
File "/usr/lib/python2.5/site-packages/South-0.6_pre-py2.5.egg/south/
db/generic.py", line 70, in execute
cursor.execute(sql, params)
File "/usr/lib/python2.5/site-packages/django/db/backends/util.py",
line 19, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/
base.py", line 84, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python2.5/site-packages/MySQLdb/cursors.py", line
163, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.5/site-packages/MySQLdb/connections.py", line
35, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1061, "Duplicate key name
'tree_family_name_base_id'")
Is this due to the django version? Python version? MySQL version? Any
thoughts? Should I change to the 3-stage migration model?