Commit 16ef7286 authored by Aurélien Bompard's avatar Aurélien Bompard Committed by Barry Warsaw

Add a commit to avoid a lock in PostgreSQL

parent 44b06852
......@@ -79,10 +79,6 @@ def upgrade():
def downgrade():
op.drop_index(op.f('ix_pendedkeyvalue_value'), table_name='pendedkeyvalue')
op.drop_index(op.f('ix_pendedkeyvalue_key'), table_name='pendedkeyvalue')
op.drop_index(op.f('ix_pended_token'), table_name='pended')
op.drop_index(op.f('ix_pended_expiration_date'), table_name='pended')
# Data migration.
connection = op.get_bind()
# Remove the introduced type keys.
......@@ -97,3 +93,8 @@ def downgrade():
connection.execute(keyvalue_table.update().where(
keyvalue_table.c.id == keyvalue['id']
).values(value=json.dumps(keyvalue['value'])))
# Remove indexes
op.drop_index(op.f('ix_pendedkeyvalue_value'), table_name='pendedkeyvalue')
op.drop_index(op.f('ix_pendedkeyvalue_key'), table_name='pendedkeyvalue')
op.drop_index(op.f('ix_pended_token'), table_name='pended')
op.drop_index(op.f('ix_pended_expiration_date'), table_name='pended')
......@@ -157,6 +157,7 @@ class TestMigrations(unittest.TestCase):
self.assertEqual(results[3]['type'], 'data')
self.assertEqual(results[4]['type'], 'held message')
self.assertEqual(results[5]['type'], 'registration')
config.db.store.commit()
# Downgrading.
alembic.command.downgrade(alembic_cfg, '33bc0099223')
results = get_from_db()
......
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