"""查标结论的来源加 presence:「文件要在」类要求按文件在不在判断,不调模型。 Revision ID: 0007 """ from __future__ import annotations from alembic import op revision = "0007" down_revision = "0006" LAYERS = "'deviation_table', 'rule_compare', 'model', 'retrieval'" def upgrade() -> None: op.get_bind().exec_driver_sql(f""" ALTER TABLE check_item_result DROP CONSTRAINT check_item_result_layer_check; ALTER TABLE check_item_result ADD CONSTRAINT check_item_result_layer_check CHECK (layer IN ({LAYERS}, 'presence')); """) def downgrade() -> None: op.get_bind().exec_driver_sql(f""" ALTER TABLE check_item_result DROP CONSTRAINT check_item_result_layer_check; ALTER TABLE check_item_result ADD CONSTRAINT check_item_result_layer_check CHECK (layer IN ({LAYERS})); """)