First time here? Check out the FAQ!

Revision history  [back]

How do I debug a Migration error?

I ran syncdb which worked. When I attempt to migrate the app, the SQL generated seems to be incorrect.

$ python manage.py migrate askbot
Running migrations for askbot:
- Migrating forwards to 0178_auto__add_field_postrevision_ip_addr.

askbot:0001_initial
askbot:0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question
FATAL ERROR - The following SQL query failed: ALTER TABLE answer ALTER COLUMN text TYPE longtext, ALTER COLUMN text DROP NOT NULL, ALTER COLUMN text DROP DEFAULT;
The error was: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE longtext, ALTER COLUMN text DROP NOT NULL, ALTER COLUMN text DROP DEFAU' at line 1")
...SNIP...
Error in migration: askbot:0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question

This is the South expression that seems to be generating the error:

Adding field 'Answer.text'

db.add_column(u'answer', 'text', self.gf('django.db.models.fields.TextField')(null=True), keep_default=False)

South.__version__ = '1.0'
MySQLdb.__version__ = '1.2.5'
MySQL 5.6.19