First time here? Check out the FAQ!
0

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

mrB's avatar
51
mrB
asked 2014-08-05 10:36:37 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

I was not able to debug the migration, but I worked around it via:

python manage.py syncdb --all

python manage.py migrate --fake

mrB's avatar
51
mrB
answered 2014-08-11 16:46:09 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments