Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Switching to Postgres but Migration issues.

I have been developing against MySQL. After researching and following the Forum I realized its better to switch to Postgres before we put this on a server. I decided to do a fresh installation from my branch and setup against postgres but ended up getting following errors:

$python manage.py migrate askbot
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 0164_update_postgres_user_search.
 > 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-10-13 17:17:56.687763';
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
/Users/anu/code/vGopherAnswers/gopheranswers/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

added '<django.utils.functional.__proxy__ object at 0x1028fbcd0>' subscription for gopher (1)
 > 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
Error in migration: askbot:0013_add_response_count__to_user
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/migrators.py", line 229, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/migrators.py", line 304, in migrate_many
    result = self.migrate(migration, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/migrators.py", line 129, in migrate
    result = self.run(migration, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/migrators.py", line 113, in run
    return self.run_migration(migration, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/migrators.py", line 88, in run_migration
    self.record(migration, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/migration/migrators.py", line 264, in record
    record = MigrationHistory.for_migration(migration, database)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/South-0.8.2-py2.7.egg/south/models.py", line 21, in for_migration
    migration=migration.name(),
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/models/manager.py", line 131, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/models/query.py", line 361, in get
    num = len(clone)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/models/query.py", line 85, in __len__
    self._result_cache = list(self.iterator())
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/models/query.py", line 291, in iterator
    for row in compiler.results_iter():
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/models/sql/compiler.py", line 763, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/models/sql/compiler.py", line 818, in execute_sql
    cursor.execute(sql, params)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/backends/util.py", line 40, in execute
    return self.cursor.execute(sql, params)
  File "/Users/anu/code/vGopherAnswers/lib/python2.7/site-packages/Django-1.4.8-py2.7.egg/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: current transaction is aborted, commands ignored until end of transaction block

I would like to get the experts opinion on this and what are the solutions that I can take to fix this?