fix: remove the unused retry index field (#11903)

Signed-off-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: Novice Lee <novicelee@NoviPro.local>
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
Novice
2024-12-23 14:32:11 +08:00
committed by GitHub
parent 4b1e13e982
commit c1aa55f3ea
16 changed files with 256 additions and 268 deletions

View File

@@ -1,9 +1,7 @@
"""add retry_index field to node-execution model
Revision ID: e1944c35e15e
Revises: 11b07f66c737
Create Date: 2024-12-20 06:28:30.287197
"""
from alembic import op
import models as models
@@ -19,15 +17,21 @@ depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('workflow_node_executions', schema=None) as batch_op:
batch_op.add_column(sa.Column('retry_index', sa.Integer(), server_default=sa.text('0'), nullable=True))
# We don't need these fields anymore, but this file is already merged into the main branch,
# so we need to keep this file for the sake of history, and this change will be reverted in the next migration.
# with op.batch_alter_table('workflow_node_executions', schema=None) as batch_op:
# batch_op.add_column(sa.Column('retry_index', sa.Integer(), server_default=sa.text('0'), nullable=True))
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('workflow_node_executions', schema=None) as batch_op:
batch_op.drop_column('retry_index')
# with op.batch_alter_table('workflow_node_executions', schema=None) as batch_op:
# batch_op.drop_column('retry_index')
pass
# ### end Alembic commands ###
# ### end Alembic commands ###

View File

@@ -0,0 +1,34 @@
"""remove workflow_node_executions.retry_index if exists
Revision ID: d7999dfa4aae
Revises: e1944c35e15e
Create Date: 2024-12-23 11:54:15.344543
"""
from alembic import op
import models as models
import sqlalchemy as sa
from sqlalchemy import inspect
# revision identifiers, used by Alembic.
revision = 'd7999dfa4aae'
down_revision = 'e1944c35e15e'
branch_labels = None
depends_on = None
def upgrade():
# Check if column exists before attempting to remove it
conn = op.get_bind()
inspector = inspect(conn)
has_column = 'retry_index' in [col['name'] for col in inspector.get_columns('workflow_node_executions')]
if has_column:
with op.batch_alter_table('workflow_node_executions', schema=None) as batch_op:
batch_op.drop_column('retry_index')
def downgrade():
# No downgrade needed as we don't want to restore the column
pass