Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

Error in migration: badger:0004_auto__add_nomination #168

Open
ToxicWar opened this issue Mar 26, 2013 · 3 comments
Open

Error in migration: badger:0004_auto__add_nomination #168

ToxicWar opened this issue Mar 26, 2013 · 3 comments

Comments

@ToxicWar
Copy link
Contributor

Error in postgreSQL 9.1
FATAL ERROR - The following SQL query failed: CREATE TABLE "badger_nomination" ("id" serial NOT NULL PRIMARY KEY, "badge_id" integer NOT NULL, "nominee_id" integer NOT NULL, "accepted" boolean NOT NULL, "creator_id" integer NULL, "approver_id" integer NULL, "award_id" integer NULL, "created" timestamp with time zone NOT NULL, "modified" timestamp with time zone NOT NULL);
The error was: current transaction is aborted, commands ignored until end of transaction block

@lmorchard
Copy link
Contributor

Hmm, I've never tried django-badger with postgresql, so I probably won't have much useful input here.

@askvictor
Copy link
Contributor

I've experienced this also; the noted hack to see if the table exists seems to be the cause of this. I bypassed the code which uses the _table_exists() function and it works fine... so after finding https://gist.github.com/rctay/527113#comment-337110 I tried:

from django.db import connection
...
def _table_exists(self, name):
    """Determine whether the table exists."""
    return name in connection.introspection.table_names()

Which works nicely in Postgres, but untested on MySQL

@sunshineo
Copy link

My workaround is this:

Manually run the query on postgresql

CREATE TABLE "badger_nomination" ("id" serial NOT NULL PRIMARY KEY, "badge_id" integer NOT NULL, "nominee_id" integer NOT NULL, "accepted" boolean NOT NULL, "creator_id" integer NULL, "approver_id" integer NULL, "award_id" integer NULL, "created" timestamp with time zone NOT NULL, "modified" timestamp with time zone NOT NULL);

manage.py migrate badger 0004_auto__add_nomination --fake

python manage.py migrate badger

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants