First time here? Check out the FAQ!

Revision history  [back]

Fresh Installation migration errors

TechStack: Django==1.4, askbot==0.7.49, (PostgreSQL) 9.1.9, psycopg2==2.4.5

When i try to start a fresh installation on a fresh DB the migrations are failing. It shows fatal error with alter table commands failing and migration halts in the middle.

Steps to reproduce: 1) Create a db in postgres: Create database askbot_test; 2) Create a virtualenv askbot 3) Install askbot and django 4) Configure the DB settings in the local django project created. 5) Run commands python manage.py syncdb ( successful ) python manage.py migrate askbot ( fails )

Error Stacktrace:

Running migrations for askbot: - Migrating forwards to 0170_auto__add_field_group_read_only.

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 "hide_ignored_questions" boolean NOT NULL DEFAULT False; The error was: column "hide_ignored_questions" 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 "tag_filter_setting" varchar(16) NOT NULL DEFAULT 'ignored'; The error was: column "tag_filter_setting" 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 '2014-02-04 15:45:25.071122'; 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

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

FATAL ERROR - The following SQL query failed: CREATE TABLE "vote" ("object_id" integer CHECK ("object_id" >= 0) NOT NULL, "voted_at" timestamp with time zone NOT NULL, "user_id" integer NOT NULL, "content_type_id" integer NOT NULL, "vote" smallint NOT NULL, "id" serial NOT NULL PRIMARY KEY) The error was: relation "vote" already exists

Error in migration: askbot:0001_initial Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 459, in execute_manager utility.execute() File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(args, *options.__dict__) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(args, *options) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle ignore_ghosts = ignore_ghosts, File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app success = migrator.migrate_many(target, workplan, database) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/migrators.py", line 232, in migrate_many result = migrator.__class__.migrate_many(migrator, target, migrations, database) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/migrators.py", line 307, in migrate_many result = self.migrate(migration, database) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/migrators.py", line 132, in migrate result = self.run(migration, database) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/migrators.py", line 116, in run return self.run_migration(migration, database) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/migrators.py", line 86, in run_migration migration_function() File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/migration/migrators.py", line 62, in return (lambda: direction(orm)) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/askbot/migrations/0001_initial.py", line 388, in forwards ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/db/generic.py", line 47, in _cache_clear return func(self, table, args, *opts) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/db/generic.py", line 361, in create_table "columns": ', '.join([col for col in columns if col]), File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/south/db/generic.py", line 282, in execute cursor.execute(sql, params) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute return self.cursor.execute(sql, params) File "/home/ubuntu/.virtualenvs/forums/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute return self.cursor.execute(query, args) django.db.utils.DatabaseError: relation "vote" already exists


Stack Trace Ends

I am not sure what i am missing here. I infact had same problems with 0.7.48. Please let me know any possible solution that i might try.