South migration error during installation

asked 2013-02-11 01:14:20 -0500

anonymous user

Anonymous

Using: OSX 10.8, Django 1.4.2, South 0.7.6 with MySQL (engine default is InnoDB).

Keep getting South migration error. I first ran manage.py syncdb (successfully) , but "python manage.py migrate askbot" raised the following error:

FATAL ERROR - The following SQL query failed: ALTER TABLE `askbot_thread` ADD CONSTRAINT `accepted_answer_id_refs_id_3a6a76b2d567ecbb` FOREIGN KEY (`accepted_answer_id`) REFERENCES `askbot_post` (`id`);
The error was: (1005, "Can't create table 'askbot.#sql-8c8b_1f' (errno: 121)")
 ! 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:   = CREATE TABLE `comment` (`comment` varchar(2048) NOT NULL, `offensive_flag_count` integer NOT NULL, `object_id` integer UNSIGNED NOT NULL, `content_type_id` integer NOT NULL, `user_id` integer NOT NULL, `score` integer NOT NULL, `html` varchar(2048) NOT NULL, `added_at` datetime NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY); []
   = CREATE TABLE `answer` (`wiki` bool NOT NULL, `vote_up_count` integer NOT NULL, `text` longtext NULL, `offensive_flag_count` smallint NOT NULL, `summary` varchar(180) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `locked_at` datetime NULL, `author_id` integer NOT NULL, `question_id` integer NOT NULL, `comment_count` integer UNSIGNED NOT NULL, `score` integer NOT NULL, `vote_down_count` integer NOT NULL, `last_edited_by_id` integer NULL, `deleted` bool NOT NULL, `deleted_at` datetime NULL, `locked` bool NOT NULL, `is_anonymous` bool NOT NULL, `locked_by_id` integer NULL, `html` longtext NULL, `added_at` datetime NOT NULL, `deleted_by_id` integer NULL, `wikified_at` datetime NULL, `last_edited_at` datetime NULL); []
   = CREATE TABLE `question` (`wiki` bool NOT NULL, `vote_up_count` integer NOT NULL, `text` longtext NULL, `offensive_flag_count` smallint NOT NULL, `summary` varchar(180) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `locked_at` datetime NULL, `author_id` integer NOT NULL, `comment_count` integer UNSIGNED NOT NULL, `score` integer NOT NULL, `vote_down_count` integer NOT NULL, `last_edited_by_id` integer NULL, `deleted` bool NOT NULL, `deleted_at` datetime NULL, `locked` bool NOT NULL, `thread_id` integer NOT NULL UNIQUE, `is_anonymous` bool NOT NULL, `locked_by_id` integer NULL, `html` longtext NULL, `added_at` datetime NOT NULL, `deleted_by_id` integer NULL, `wikified_at` datetime NULL, `last_edited_at` datetime NULL); []
   = ALTER TABLE `askbot_thread` ADD COLUMN `accepted_answer_post_id` integer NULL; []
   - no dry run output for alter_column() due to dynamic DDL, sorry
   - no dry run output for delete_foreign_key() due to dynamic DDL, sorry
   = ALTER TABLE `askbot_thread` DROP COLUMN `accepted_answer_id` CASCADE; []

 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS (one that supports DDL transactions)
 ! NOTE: The error which caused the migration to fail is further up.
Error in migration: askbot:0101_megadeath_of_q_a_c
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Users/yuvalweinbaum/Envs/askbot/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/Users/yuvalweinbaum/Envs/askbot/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/yuvalweinbaum/Envs/askbot/lib/python2.7/site-packages/Django-1.4.3-py2.7 ...
(more)
edit retag flag offensive close merge delete

Comments

We have an issue with InnoDB, there is a fork with a fix, I will look into merging it this week. Please try to use Postgres if you can.

Evgeny gravatar imageEvgeny ( 2013-02-11 01:16:11 -0500 )edit

What is the name of the forked project?

joel gravatar imagejoel ( 2013-02-11 23:46:17 -0500 )edit
1

Possibly this commit: https://github.com/joschabach/icontology/commit/95d9a139325a1a621e0b279391ded1d01693d456 or somewhere on that branch, I have not tested though. Strongly recommend postgresql.

Evgeny gravatar imageEvgeny ( 2013-02-11 23:50:49 -0500 )edit

@Evgeny But if used postgresql, can i use sphinx to support chinese full text search?

jqy3222089 gravatar imagejqy3222089 ( 2013-02-12 09:47:42 -0500 )edit

@Evgeny your solution works fine. Thanks.

jqy3222089 gravatar imagejqy3222089 ( 2013-02-12 11:39:24 -0500 )edit