travelbird/django-denorm — pull request #1 by jose-lpa (2013-02-12 15:00:19+00:00)
Title: Migration 0002 modified to prevent exceptions in MySQL.

This error was raised when running CI test batteries for MySQL database:

```
Installing custom SQL ...
Installing indexes ...
Migrating...
Running migrations for denorm:
- Migrating forwards to 0002_auto__chg_field_dirtyinstance_object_id.
> denorm:0001_initial
> denorm:0002_auto__chg_field_dirtyinstance_object_id
! 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:
! 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 "/Users/jose/Work/recharted/bin/django", line 60, in
djangorecipe.manage.main('cesta.conf.settings_development')
File "/Users/jose/Work/recharted/eggs/djangorecipe-0.20-py2.7.egg/djangorecipe/manage.py", line 16, in main
management.execute_manager(mod)
File "/Users/jose/Work/recharted/parts/django/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/jose/Work/recharted/parts/django/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/jose/Work/recharted/parts/django/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/jose/Work/recharted/parts/django/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/management/commands/test.py", line 8, in handle
super(Command, self).handle(*args, **kwargs)
File "/Users/jose/Work/recharted/parts/django/django/core/management/commands/test.py", line 37, in handle
failures = test_runner.run_tests(test_labels)
File "/Users/jose/Work/recharted/parts/vcs-checkouts/django-nose/django_nose/runner.py", line 60, in run_tests
old_names = self.setup_databases()
File "/Users/jose/Work/recharted/parts/django/django/test/simple.py", line 296, in setup_databases
test_db_name = connection.creation.create_test_db(self.verbosity, autoclobber=not self.interactive)
File "/Users/jose/Work/recharted/parts/django/django/db/backends/creation.py", line 366, in create_test_db
load_initial_data=False)
File "/Users/jose/Work/recharted/parts/django/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/Users/jose/Work/recharted/parts/django/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/jose/Work/recharted/parts/django/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/management/commands/syncdb.py", line 99, in handle_noargs
management.call_command('migrate', **options)
File "/Users/jose/Work/recharted/parts/django/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/Users/jose/Work/recharted/parts/django/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/management/commands/migrate.py", line 105, in handle
ignore_ghosts = ignore_ghosts,
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/__init__.py", line 191, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 221, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 292, in migrate_many
result = self.migrate(migration, database)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 125, in migrate
result = self.run(migration)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 99, in run
return self.run_migration(migration)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 81, in run_migration
migration_function()
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 57, in
return (lambda: direction(orm))
File "/Users/jose/Work/recharted/parts/vcs-checkouts/django-denorm/denorm/migrations/0002_auto__chg_field_dirtyinstance_object_id.py", line 12, in forwards
db.alter_column('denorm_dirtyinstance', 'object_id', self.gf('django.db.models.fields.TextField')(null=True))
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/db/generic.py", line 387, in alter_column
self.execute("ALTER TABLE %s %s;" % (self.quote_name(table_name), sql), values)
File "/Users/jose/Work/recharted/eggs/South-0.7.3-py2.7.egg/south/db/generic.py", line 150, in execute
cursor.execute(sql, params)
File "/Users/jose/Work/recharted/parts/django/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/Users/jose/Work/recharted/eggs/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg/MySQLdb/cursors.py", line 201, in execute
self.errorhandler(self, exc, value)
File "/Users/jose/Work/recharted/eggs/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1170, "BLOB/TEXT column 'object_id' used in key specification without a key length")
```

A solution for this is explained in this SO thread:

http://stackoverflow.com/questions/11983232/cannot-get-django-activity-stream-database-tables-installed

Just applied that for our case.