Avoid missing table errors on initial syncdb or migrate. see : https://g... #2

Merged
merged 1 commit into from Dec 29, 2011

3 participants

@MegaMark16 MegaMark16 merged commit b8ea502 into MegaMark16:master Dec 29, 2011
@notNotDaniel

This error still occurs if using psycopg2, because the transaction is never rolled back, and any subsequent attempt to use the database fails. It appears to be possible to work around this by catching the DatabaseError and rolling back the transaction as necessary. E.g.:

def set_themes():
try:
if not Site.objects.filter(id=settings.SITE_ID):
return
except DatabaseError:
connection.rollback();
return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment