mirror of https://github.com/langgenius/dify.git
refactor: extract backup table name as module constant
Share backup_table_name between upgrade() and downgrade() functions to avoid duplication and ensure consistency.
This commit is contained in:
parent
d3490ebb0f
commit
4e8e53c579
|
|
@ -16,11 +16,13 @@ down_revision = 'b95962a3885c'
|
|||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
# Backup table name for soft-deleted conversations
|
||||
backup_table_name = 'conversations_4f02b6704509_bak'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
# Create backup table for soft-deleted conversations
|
||||
backup_table_name = 'conversations_4f02b6704509_bak'
|
||||
|
||||
# Check if there are any soft-deleted conversations
|
||||
result = op.get_bind().execute(sa.text("SELECT COUNT(*) FROM conversations WHERE is_deleted = true"))
|
||||
|
|
@ -48,7 +50,6 @@ def downgrade():
|
|||
batch_op.add_column(sa.Column('is_deleted', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False))
|
||||
|
||||
# Restore soft-deleted conversations from backup table if it exists
|
||||
backup_table_name = 'conversations_4f02b6704509_bak'
|
||||
|
||||
# Check if backup table exists
|
||||
result = op.get_bind().execute(sa.text(f"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue