Merge "Close DB migration sessions explicitly for compatibility with PyMySQL"

This commit is contained in:
Jenkins
2015-07-14 17:57:30 +00:00
committed by Gerrit Code Review
3 changed files with 8 additions and 1 deletions

View File

@@ -467,6 +467,9 @@ function init_manila {
# (re)create manila database
recreate_database manila utf8
$MANILA_BIN_DIR/manila-manage db sync
# Display version as debug-action (see bug/1473400)
$MANILA_BIN_DIR/manila-manage db version
fi
# Create cache dir

View File

@@ -55,7 +55,8 @@ def upgrade():
sa.Column('updated_at', sa.DateTime))
export_locations = []
for share in op.get_bind().execute(shares_table.select()):
session = sa.orm.Session(bind=op.get_bind().connect())
for share in session.query(shares_table).all():
deleted = share.deleted if isinstance(share.deleted, int) else 0
export_locations.append({
'created_at': share.created_at,
@@ -68,6 +69,7 @@ def upgrade():
op.bulk_insert(export_locations_table, export_locations)
op.drop_column('shares', 'export_location')
session.close_all()
def downgrade():
@@ -106,3 +108,4 @@ def downgrade():
connection.execute(update)
op.drop_table('share_export_locations')
session.close_all()

View File

@@ -70,6 +70,7 @@ def upgrade():
})
op.bulk_insert(es_table, extra_specs)
session.close_all()
def downgrade():