First time here? Check out the FAQ!

Revision history  [back]

Initialization of AskBot database: `python manage.py migrate askbot` fails?

I am trying to install AskBot.

I follow the instructions until "Initialization and upgrade of the database for Askbot"

I execute this step:

$ python manage.py syncdb

and it completes without error.

I then execute this step:

$ python manage.py migrate askbot

and I get several pages of errors. Can someone tell me what the problem is? I include the output of python manage.py migrate askbot below:

$ python manage.py migrate askbot
Please run command

    python manage.py collectstatic
WARNING!!! You are using a 'locmem' (local memory) caching backend,
which is OK for a low volume site running on a single-process server.
For a multi-process configuration it is neccessary to have a production
cache system, such as redis or memcached.

With local memory caching and multi-process setup you might intermittently
see outdated content on your site.

relation "askbot_badgedata" does not exist
LINE 1: ..."."slug", "askbot_badgedata"."awarded_count" FROM "askbot_ba...
                                                             ^

Running migrations for askbot:
 - Migrating forwards to 0161_add_field__user_languages.
 > askbot:0001_initial
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "website" varchar(200) NULL;
The error was: column "website" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "about" text NULL;
The error was: column "about" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "gold" smallint NOT NULL DEFAULT 0;
The error was: column "gold" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "email_isvalid" boolean NOT NULL DEFAULT False;
The error was: column "email_isvalid" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "real_name" varchar(100) NULL;
The error was: column "real_name" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "location" varchar(100) NULL;
The error was: column "location" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "email_key" varchar(32) NULL;
The error was: column "email_key" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "date_of_birth" date NULL;
The error was: column "date_of_birth" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "reputation" integer CHECK ("reputation" >= 0) NOT NULL DEFAULT 1;
The error was: column "reputation" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "gravatar" varchar(32) NULL;
The error was: column "gravatar" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "bronze" smallint NOT NULL DEFAULT 0;
The error was: column "bronze" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "last_seen" timestamp with time zone NOT NULL DEFAULT '2013-02-18 20:19:07.317870';
The error was: column "last_seen" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "silver" smallint NOT NULL DEFAULT 0;
The error was: column "silver" of relation "auth_user" already exists

FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "questions_per_page" smallint NOT NULL DEFAULT 10;
The error was: column "questions_per_page" of relation "auth_user" already exists

 > askbot:0002_auto__add_field_answer_text__chg_field_answer_html__add_field_question
 > askbot:0003_copy_denorm_text_record_to_posts_for_fulltext_search
 > askbot:0004_install_full_text_indexes_for_mysql
 > askbot:0005_install_badges
/usr/local/lib/python2.7/dist-packages/askbot/migrations/0005_install_badges.py:64: RuntimeWarning: Argument <type 'str'> is not an unicode object. Passing an encoded string will likely have unexpected results.
  print 'adding new badge %s' % unidecode(name)
adding new badge Disciplined
adding new badge Peer Pressure
adding new badge Nice answer
adding new badge Nice Question
adding new badge Pundit
adding new badge Popular Question
adding new badge Citizen patrol
adding new badge Cleanup
adding new badge Critic
adding new badge Editor
adding new badge Organizer
adding new badge Scholar
adding new badge Student
adding new badge Supporter
adding new badge Teacher
adding new badge Autobiographer
adding new badge Self-Learner
adding new badge Great Answer
adding new badge Great Question
adding new badge Stellar Question
adding new badge Famous question
adding new badge Alpha
adding new badge Good Answer
adding new badge Good Question
adding new badge Favorite Question
adding new badge Civic duty
adding new badge Strunk & White
adding new badge Generalist
adding new badge Expert
adding new badge Yearling
adding new badge Notable Question
adding new badge Enlightened
adding new badge Beta
adding new badge Guru
adding new badge Necromancer
adding new badge Taxonomist
 > askbot:0006_add_subscription_setting_for_comments_and_mentions

**************
Adding subscription on comment responses and name mentions for each user. 
frequency will be automatically set to the most frequent selection 
that user made for any other types of subscriptions

 > askbot:0007_install_mentions_model
 > askbot:0008_add_html_field_to_comments
 > askbot:0009_calculate_html_field_for_comments
 > askbot:0010_add_receiving_user_to_activity_model
 > askbot:0011_merge_mentions_into_activity
 > askbot:0012_delete_some_unused_models
 > askbot:0013_add_response_count__to_user
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "response_count" integer NOT NULL DEFAULT 0;
The error was: column "response_count" of relation "auth_user" already exists

probably already have column User.response_count
 > askbot:0014_rename_schema_from_forum_to_askbot
FATAL ERROR - The following SQL query failed: ALTER TABLE "forum_anonymousanswer" RENAME TO "askbot_anonymousanswer";
The error was: relation "forum_anonymousanswer" does not exist

 > askbot:0015_rename_forum_contenttypes_to_askbot
 > askbot:0016_auto__del_validationhash
 > askbot:0017_add_group__moderators
 > askbot:0018_add___status__field_to_user_model
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "status" varchar(2) NOT NULL DEFAULT 'w';
The error was: column "status" of relation "auth_user" already exists

 > askbot:0019_populate_user_status_field
 > askbot:0020_auto__add_field_repute_comment__chg_field_repute_question
 > askbot:0021_auto__add_field_comment_score
 > askbot:0022_init_postgresql_full_text_search
 > askbot:0023_auto__add_activityauditstatus
 > askbot:0024_add_recipients_m2m_to_activity_and_denorm_question_on_activity
 > askbot:0025_transfer_flagged_items_to_activity
 > askbot:0026_add_seen_and_new_response_counts_to_user
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "new_response_count" integer NOT NULL DEFAULT 0;
The error was: column "new_response_count" of relation "auth_user" already exists

 > askbot:0027_populate_new_response_counts
 > askbot:0028_delete_response_count_column_from_user_model
 > askbot:0029_auto__del_flaggeditem
 > askbot:0030_rename_badge_to_badgedata
 > askbot:0031_synchronize_badge_slug_with_name
 > askbot:0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d
 > askbot:0033_add__consecutive_days_visit_count__to__auth_user
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "consecutive_days_visit_count" integer NOT NULL DEFAULT 0;
The error was: column "consecutive_days_visit_count" of relation "auth_user" already exists

 > askbot:0034_auto__add_field_user_avatar_url
 > askbot:0035_add_country_fields_to_user
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "country" varchar(2) NULL;
The error was: column "country" of relation "auth_user" already exists

 > askbot:0036_auto__add_field_anonymousquestion_is_anonymous__add_field_questionrevi
 > askbot:0037_add_marked_tags_to_user_profile
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "interesting_tags" text NOT NULL DEFAULT '';
The error was: column "interesting_tags" of relation "auth_user" already exists

 > askbot:0038_add_tag_filter_strategies
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "email_tag_filter_strategy" smallint NOT NULL DEFAULT 1;
The error was: column "email_tag_filter_strategy" of relation "auth_user" already exists

 > askbot:0039_populate_tag_filter_strategies
 > askbot:0040_delete_old_tag_filter_strategies
 > askbot:0041_add_field_comment_offensive_flag_count
 > askbot:0042_auto__add_field_activity_summary
 > askbot:0043_add_temporal_extra_column_for_datamigration
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "avatar_type" varchar(1) NOT NULL DEFAULT 'n';
The error was: column "avatar_type" of relation "auth_user" already exists

 > askbot:0044_migrate_has_custom_avatar_field
Migrating users to new avatar field
 > askbot:0045_delete_has_custom_avatar
 > askbot:0046_add_uniques_to_email_feed_settings
 > askbot:0047_auto__add_field_answerrevision_revision_type__add_field_answerrevision
 > askbot:0048_set_proper_revision_types
 > askbot:0049_add_postrevision_model
 > askbot:0050_move_qa_revisions_to_postrevision
 > askbot:0051_proxify_qa_rev_models
 > askbot:0052_auto__add_thread__add_field_question_thread
 > askbot:0053_create_threads_for_questions
Converting question to threads:
 > askbot:0054_auto__del_field_question_favourite_count
 > askbot:0055_auto__chg_field_question_thread
 > askbot:0056_transplant_answer_count_field
 > askbot:0057_transplant_answer_count_data
 > askbot:0058_transplant_answer_count_field_2
 > askbot:0059_auto__add_field_thread_view_count
 > askbot:0060_view_count_transplant
 > askbot:0061_auto__del_field_question_view_count
 > askbot:0062_transplant_question_closed_fields
 > askbot:0063_transplant_question_closed_datas
 > askbot:0064_transplant_question_closed_fields_2
 > askbot:0065_transplant_accepted_answer_1
 > askbot:0066_transplant_accepted_answer_data
 > askbot:0067_transplant_accepted_answer_2
 > askbot:0068_transplant_last_activity_fields_1
 > askbot:0069_transplant_last_activity_data
 > askbot:0070_transplant_last_activity_fields_2
 > askbot:0071_transplant_tagnames_1
 > askbot:0072_transplant_tagnames_data
 > askbot:0073_transplant_tagnames_2
 > askbot:0074_transplant_followed_by_1
 > askbot:0075_transplant_followed_by_data
 > askbot:0076_transplant_followed_by_2
 > askbot:0077_transplant_summary_1
 > askbot:0078_transplant_favquestions_1
 > askbot:0079_transplant_favquestions_data
 > askbot:0080_transplant_favquestions_2
 > askbot:0081_transplant_title_1
 > askbot:0082_transplant_title_data
 > askbot:0083_transplant_title_2
 > askbot:0084_auto__add_field_answer_is_anonymous
 > askbot:0085_transplant_question_tags_1
 > askbot:0086_transplant_question_tags_data
 > askbot:0087_transplant_question_tags_2
 > askbot:0088_install__post_view__for__development
 > askbot:0089_auto__add_post
 > askbot:0090_postize_q_a_c
 !!! Remember to not remove the old content types for Question, Answer and Comment models until further notice from migration 0101! 
 [DEBUG] Initial Post.id == 1 
 > askbot:0091_auto__add_field_vote_voted_post__add_field_activity_question_post
 > askbot:0092_postize_vote_and_activity
 > askbot:0093_auto__del_field_vote_content_type__del_field_vote_object_id__chg_field
 > askbot:0094_auto__add_field_repute_question_post
 > askbot:0095_postize_award_and_repute
 > askbot:0096_auto__del_field_repute_question
 > askbot:0097_auto__add_field_thread_accepted_answer_post__add_field_anonymousanswer
 > askbot:0098_postize_thread_anonanswer_questionview_postrevision
 > askbot:0099_auto__del_field_thread_accepted_answer__del_field_anonymousanswer_ques
 > askbot:0100_auto__del_field_post_self_question__del_field_post_self_answer__del_fi
 > askbot:0101_megadeath_of_q_a_c
 You are free now to remove content types for Question/Answer/Comment models 
 > askbot:0102_rename_post_fields_back_1
 > askbot:0103_rename_post_fields_back_2
 > askbot:0104_auto__del_field_repute_question_post__add_field_repute_question
 > askbot:0105_restore_anon_ans_q
 > askbot:0106_update_postgres_full_text_setup
 > askbot:0107_added_db_indexes
 > askbot:0108_auto__add_field_thread_score
 > askbot:0109_denormalize_question_vote_to_thread
 > askbot:0110_auto__add_field_thread_added_at
 > askbot:0111_populate__thread__added_at
 > askbot:0112_add_model_ReplyAddress
 > askbot:0113_auto__add_field_thread_added_at__add_field_thread_score__add_field_rep
 > askbot:0114_auto__add_groupprofile__add_groupmembership__add_field_tag_tag_wiki
 > askbot:0115_auto__chg_field_post_thread
 > askbot:0116_auto__add_field_groupprofile_logo_url__add_unique_emailfeedsetting_sub
 > askbot:0117_auto__add_field_post_approved__add_field_thread_approved__add_field_po
 > askbot:0118_auto__add_field_postrevision_by_email
 > askbot:0119_auto__add_postflagreason
 > askbot:0120_auto__add_field_groupprofile_moderate_email__add_field_postrevision_em
 > askbot:0121_auto__add_field_groupprofile_is_open__add_field_groupprofile_preapprov
 > askbot:0122_auth_user__add_subscribed_tag_field
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "subscribed_tags" text NOT NULL DEFAULT '';
The error was: column "subscribed_tags" of relation "auth_user" already exists

 > askbot:0123_setup_postgres_user_search
 > askbot:0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "email_signature" text NOT NULL DEFAULT '';
The error was: column "email_signature" of relation "auth_user" already exists

 > askbot:0125_add_show_tags_field_to_user
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "show_marked_tags" boolean NOT NULL DEFAULT True;
The error was: column "show_marked_tags" of relation "auth_user" already exists

 > askbot:0126_add_field__auth_user__is_fake
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "is_fake" boolean NOT NULL DEFAULT False;
The error was: column "is_fake" of relation "auth_user" already exists

 > askbot:0127_save_category_tree_as_json
 > askbot:0128_add_groups_field__to__thread_and_post
 > askbot:0129_auto__del_field_post_is_private
 > askbot:0130_auto__del_field_postrevision_revision_type
 > askbot:0131_auto__add_field_tag_status
 > askbot:0132_auto__add_draftquestion__add_draftanswer
 > askbot:0133_apply_global_group_to_posts_and_users
 > askbot:0134_create_personal_groups_for_all_users
 > askbot:0135_auto__add_questionwidget__add_askwidget
 > askbot:0136_auto__add_group__add_threadtogroup__add_unique_threadtogroup_thread_ta
 > askbot:0137_create_groups_from_relevant_tags
 > askbot:0138_auto__del_groupprofile__del_groupmembership__del_unique_groupmembershi
 > askbot:0139_add__openness__field_to_group
 > askbot:0140_move_group_field__is_open__to_openness
 > askbot:0141_auto__del_field_group_is_open
 > askbot:0142_auto__add_groupmembership
 > askbot:0143_populate_group_memberships
 > askbot:0144_auto__add_field_questionwidget_group__add_field_askwidget_group
 > askbot:0145_add_moderate_answers_to_enquirers__to_askbot_group
 > askbot:0146_auto__add_field_threadtogroup_visibility
 > askbot:0147_auto__add_field_group_description
 > askbot:0148_rename_personal_groups
 > askbot:0149_auto__add_field_group_is_vip
 > askbot:0150_auto__add_field_post_new_summary
 > askbot:0151_copy_post_summary_to_new_field
 > askbot:0152_auto__del_field_post_summary
 > askbot:0153_rename_new_summary_field_to_summary_on_post_model
 > askbot:0154_update_postgres_user_search
 > askbot:0155_remove_unused_internal_tags
Deleting unused tags added for internal bookkeeping...
None found
 > askbot:0156_add_message_model_in_new_django
 > askbot:0157_auto__del_field_anonymousquestion_summary__del_field_anonymousanswer_s
 > askbot:0158_add_title_search_indices_for_postgresql_and_mysql
 > askbot:0159_auto__add_field_thread_language_code
 > askbot:0160_add_model_BulkTagSubscription
 > askbot:0161_add_field__user_languages
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "languages" varchar(128) NOT NULL DEFAULT 'en';
The error was: column "languages" of relation "auth_user" already exists

Error in migration: askbot:0161_add_field__user_languages
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 108, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/local/lib/python2.7/dist-packages/south/migration/__init__.py", line 213, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 235, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 310, in migrate_many
    result = self.migrate(migration, database)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 107, in run
    return self.run_migration(migration)
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/usr/local/lib/python2.7/dist-packages/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/usr/local/lib/python2.7/dist-packages/askbot/migrations/0161_add_field__user_languages.py", line 14, in forwards
    keep_default=False)
  File "/usr/local/lib/python2.7/dist-packages/south/db/generic.py", line 44, in _cache_clear
    return func(self, table, *args, **opts)
  File "/usr/local/lib/python2.7/dist-packages/south/db/generic.py", line 409, in add_column
    self.execute(sql)
  File "/usr/local/lib/python2.7/dist-packages/south/db/generic.py", line 273, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 40, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: column "languages" of relation "auth_user" already exists