* Move plugin table creation before insertion and ignore errors during Postgres
selenium-screenshot-testing
Kevin Chung 2019-03-01 15:37:02 -08:00 committed by GitHub
parent 2f252f5240
commit bf799fb220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from CTFd.cache import cache
from datafreeze.format import SERIALIZERS
from flask import current_app as app
from datafreeze.format.fjson import JSONSerializer, JSONEncoder
from sqlalchemy.exc import OperationalError
import dataset
import datafreeze
import datetime
@ -159,6 +160,16 @@ def import_ctf(backup, erase=True):
alembic_version = json.loads(backup.open('db/alembic_version.json').read())["results"][0]["version_num"]
upgrade(revision=alembic_version)
# Create tables created by plugins
try:
app.db.create_all()
except OperationalError as e:
if not postgres:
raise e
else:
print("Allowing error during app.db.create_all() due to Postgres")
members.remove('db/alembic_version.json')
for member in members: