chore(migration): Add the warning comments.

Signed-off-by: -LAN- <laipz8200@outlook.com>
pull/21228/head
-LAN- 11 months ago
parent d3213b64bb
commit b42c24ee9d
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

@ -29,12 +29,21 @@ def upgrade():
def downgrade(): def downgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
# WARNING: This downgrade CANNOT recover the original sequence_number values!
# The original sequence numbers are permanently lost after the upgrade.
# This downgrade will regenerate sequence numbers based on created_at order,
# which may result in different values than the original sequence numbers.
#
# If you need to preserve original sequence numbers, use the alternative
# migration approach that creates a backup table before removal.
# Step 1: Add sequence_number column as nullable first # Step 1: Add sequence_number column as nullable first
with op.batch_alter_table('workflow_runs', schema=None) as batch_op: with op.batch_alter_table('workflow_runs', schema=None) as batch_op:
batch_op.add_column(sa.Column('sequence_number', sa.INTEGER(), autoincrement=False, nullable=True)) batch_op.add_column(sa.Column('sequence_number', sa.INTEGER(), autoincrement=False, nullable=True))
# Step 2: Populate sequence_number values based on created_at order within each app # Step 2: Populate sequence_number values based on created_at order within each app
# This recreates the original sequence numbering logic # NOTE: This recreates sequence numbering logic but values will be different
# from the original sequence numbers that were removed in the upgrade
connection = op.get_bind() connection = op.get_bind()
connection.execute(sa.text(""" connection.execute(sa.text("""
UPDATE workflow_runs UPDATE workflow_runs

Loading…
Cancel
Save