diff options
| author | Aurélien Bompard | 2015-12-07 18:38:40 +0100 |
|---|---|---|
| committer | Barry Warsaw | 2015-12-16 11:16:07 -0500 |
| commit | 8c83cf02417ffd03d4e893a9d9b785d267f80ca7 (patch) | |
| tree | b2e0f3eab489b309928998d36a642181979b3303 /src | |
| parent | 80b9617ec1db01e176f2aab9c3c5e35fb2dbcafd (diff) | |
| download | mailman-8c83cf02417ffd03d4e893a9d9b785d267f80ca7.tar.gz mailman-8c83cf02417ffd03d4e893a9d9b785d267f80ca7.tar.zst mailman-8c83cf02417ffd03d4e893a9d9b785d267f80ca7.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py b/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py index 888a6544c..4a55b7347 100644 --- a/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py +++ b/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py @@ -98,3 +98,17 @@ def downgrade(): 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. + connection.execute(keyvalue_table.delete().where(sa.and_( + keyvalue_table.c.key == 'type', + keyvalue_table.c.value.in_(TYPE_CLUES.values()) + ))) + # Convert the other type keys to JSON. + keyvalues = connection.execute(keyvalue_table.select().where( + keyvalue_table.c.key == 'type')).fetchall() + for keyvalue in keyvalues: + connection.execute(keyvalue_table.update().where( + keyvalue_table.c.id == keyvalue['id'] + ).values(value=json.dumps(keyvalue['value']))) |
