Ask Your Question
0

How do I debug a Migration error?

asked 2014-08-05 10:36:37 -0500

mrB gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-08-11 16:46:09 -0500

mrB gravatar image

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

python manage.py syncdb --all

python manage.py migrate --fake

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-08-05 10:36:37 -0500

Seen: 2,406 times

Last updated: Aug 11 '14