Skip to content
Snippets Groups Projects

fix(db): old deleted transition names remain in history table"

Merged f00wl requested to merge 144-deleted-transitions-remain-in-history-database-table into dev
1 file
+ 55
0
Compare changes
  • Side-by-side
  • Inline
  • cc08aebb
    some old transitions in db have unknown values in actual code base.
    Thoses values remain after code changed, moderation view has reveal it.
    This fix update unknown values to the actual ones used for the same
    purpose.
""" 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
Loading