Ticket #513 (closed defect: invalid)

Opened 4 years ago

Last modified 4 years ago

Migration fails on django-cms

Reported by: admin@… Owned by: andrew
Priority: major Milestone:
Component: migrations Version: 0.7.1
Keywords: Cc:

Description

> picture:0005_table_rename
 ! 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:   = RENAME TABLE `cmsplugin_picture` TO `picture_picture`; []
   = RENAME TABLE `cmsplugin_picturepublic` TO `picture_publicpicture`; []
   = ALTER TABLE `picture_picture` ; []
   = ALTER TABLE `picture_picture` MODIFY `public_id` integer NULL;; []
   = ALTER TABLE `picture_picture` ALTER COLUMN `public_id` DROP DEFAULT; []
   = ALTER TABLE `picture_picture` ADD CONSTRAINT `public_id_refs_publiccmsplugin_ptr_id_1c18ba4a` FOREIGN KEY (`public_id`) REFERENCES `picture_publicpicture` (`publiccmsplugin_ptr_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 11, in <module>
    execute_manager(settings)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/management/commands/migrate.py", line 109, in handle
    ignore_ghosts = ignore_ghosts,
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/__init__.py", line 202, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/migrators.py", line 220, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/migrators.py", line 291, in migrate_many
    result = self.migrate(migration, database)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/migrators.py", line 125, in migrate
    result = self.run(migration)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/migrators.py", line 99, in run
    return self.run_migration(migration)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/cms/plugins/picture/migrations/0005_table_rename.py", line 12, in forwards
    db.alter_column('cmsplugin_picture', 'public_id', orm['picture.picture:public'])
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/db/generic.py", line 373, in alter_column
    field.rel.to._meta.get_field(field.rel.field_name).column
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/south/db/generic.py", line 134, in execute
    cursor.execute(sql, params)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/django/db/backends/util.py", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 86, in execute
    return self.cursor.execute(query, args)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
    self.errorhandler(self, exc, value)
  File "/home/www/fly.mar.lt/env/lib/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1005, "Can't create table 'fly.#sql-478d_11c' (errno: 150)")

picture:0005_table_rename looks like:
http://github.com/digi604/django-cms-2.0/blob/master/cms/plugins/picture/migrations/0005_table_rename.py

MySQL is 5.1
Django is 1.2.1
south is 0.7.1
django-cms 2.1.0beta2

happens with south 0.7.1, 0.7

Change History

comment:2 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to invalid

I don't provide support for django-cms, but I suggest you look at #332 - that ticket has a similar problem (but on PostgreSQL), and the resolution at the end might fix it for you.

comment:3 Changed 4 years ago by damian

  • Status changed from closed to reopened
  • Resolution invalid deleted

I had the very save failure as this point 'picture:0005_table_rename'. The problem seems to be that the migrations only work on MyISAM tables and not InnoDB as INNODB has stricter constraints. The work around it I removed the "init_command": "SET storage_engine=INNODB" section from my DATABASES configuration in settings.py. I haven't tried to convert the current MyISAM to INNODB yet but I think I will leave it in MyISAM structure for now.

comment:4 Changed 4 years ago by andrew

  • Status changed from reopened to closed
  • Resolution set to invalid

As I said before, this bug is not a South issue, but particular to django-cms; please open a bug there if you're still having issues, or reduce the problem to an identifiable problem in South itself (South deals fine with most InnoDB or MyISAM setups).

Note: See TracTickets for help on using tickets.