Commit 9f6a9336 authored by Ziirish's avatar Ziirish

fix db migrations

parent c66440d4
Pipeline #903 failed with stage
in 2 minutes and 4 seconds
......@@ -6,6 +6,7 @@ Changelog
- Fix: bui-agent was broken
- Fix: handle i18n exceptions
- Fix: enable db migration only when needed
0.4.1 (12/15/2016)
------------------
......
......@@ -47,14 +47,21 @@ try:
from .ext.sql import db
from flask_migrate import Migrate
app.config['WITH_SQL'] = True
create_db(app, True)
mig_dir = os.getenv('BUI_MIGRATIONS')
if mig_dir:
migrate = Migrate(app, db, mig_dir)
# This may have been reseted by create_app
if isinstance(app.database, bool):
app.config['WITH_SQL'] = app.database
else:
migrate = Migrate(app, db)
app.config['WITH_SQL'] = app.database and \
self.database.lower() != 'none'
if app.config['WITH_SQL']:
create_db(app, True)
mig_dir = os.getenv('BUI_MIGRATIONS')
if mig_dir:
migrate = Migrate(app, db, mig_dir)
else:
migrate = Migrate(app, db)
except ImportError:
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment