refactor(tests): merge detect_suggested_procedure into expected_detection
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Two overlapping TestTemplate fields (expected_detection: narrative guidance from imports/leads; detect_suggested_procedure: concrete commands from approved suggestions) are now one. Blue-side procedure suggestions target expected_detection directly, appending onto whatever is already there rather than overwriting it — same merge-not-overwrite behavior already used for the red side. Existing detect_suggested_procedure data is folded into expected_detection before the column is dropped.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Merge TestTemplate.detect_suggested_procedure into expected_detection.
|
||||
|
||||
Two overlapping fields on TestTemplate — expected_detection (narrative
|
||||
guidance, populated by imports and leads since long before this feature)
|
||||
and detect_suggested_procedure (concrete commands, populated only via the
|
||||
procedure-suggestion approval workflow) — are consolidated into one:
|
||||
expected_detection. Any existing detect_suggested_procedure text is
|
||||
appended (not overwritten) onto expected_detection before the column is
|
||||
dropped, so nothing already approved is lost.
|
||||
|
||||
Revision ID: b063
|
||||
Revises: b062
|
||||
Create Date: 2026-07-15
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "b063"
|
||||
down_revision = "b062"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"""
|
||||
UPDATE test_templates
|
||||
SET expected_detection = CASE
|
||||
WHEN expected_detection IS NULL OR expected_detection = '' THEN detect_suggested_procedure
|
||||
ELSE expected_detection || E'\n' || detect_suggested_procedure
|
||||
END
|
||||
WHERE detect_suggested_procedure IS NOT NULL AND detect_suggested_procedure != ''
|
||||
"""
|
||||
)
|
||||
op.drop_column("test_templates", "detect_suggested_procedure")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.add_column("test_templates", sa.Column("detect_suggested_procedure", sa.Text(), nullable=True))
|
||||
Reference in New Issue
Block a user