Open ToxicWar opened 11 years ago
Hmm, I've never tried django-badger with postgresql, so I probably won't have much useful input here.
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
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
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