diff --git a/migrations/versions/8652789edda9_update_obselete_transition_names.py b/migrations/versions/8652789edda9_update_obselete_transition_names.py new file mode 100644 index 0000000000000000000000000000000000000000..0d4d9e5007c9ce98a6a1266891beb37a4510c901 --- /dev/null +++ b/migrations/versions/8652789edda9_update_obselete_transition_names.py @@ -0,0 +1,55 @@ +""" update obselete transition names in history + +Revision ID: 8652789edda9 +Revises: 0147b747696e +Create Date: 2024-10-01 01:18:46.781652 +""" + +from alembic import op +import sqlalchemy as sa +import hiboo + + +revision = "8652789edda9" +down_revision = "0147b747696e" +branch_labels = None +depends_on = None + +history_table = sa.Table( + "history", + sa.MetaData(), + sa.Column("category", sa.String(length=25), nullable=True), + sa.Column("value", sa.String(), nullable=True), +) + + +def upgrade(): + connection = op.get_bind() + connection.execute( + history_table.update() + .where( + sa.and_( + history_table.c.category == "transition", + sa.or_( + history_table.c.value == "purge-deleted", + history_table.c.value == "purge-blocked", + ), + ) + ) + .values(value="purge") + ) + connection.execute( + history_table.update() + .where( + sa.and_( + history_table.c.category == "transition", + history_table.c.value == "delete-blocked", + ) + ) + .values(value="delete") + ) + + +def downgrade(): + """I don't think there will be a return journey""" + pass