fix(backend): sprint 3 post-review — nullable migration + dead code + tactic names
- Migration 0003: enforce techniques NOT NULL via batch_alter_table - Migration 0003: remove unused _sims table proxy and dead column/table imports - mitre.py: add _TACTIC_NAMES dict to fix 'Command And Control' → 'Command and Control'
This commit is contained in:
@@ -8,7 +8,7 @@ import json
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import column, table, text
|
||||
from sqlalchemy.sql import text
|
||||
|
||||
|
||||
revision = "0003"
|
||||
@@ -16,15 +16,6 @@ down_revision = "0002"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
# Lightweight table proxies for data migration (no ORM import).
|
||||
_sims = table(
|
||||
"simulations",
|
||||
column("id", sa.Integer),
|
||||
column("mitre_technique_id", sa.String),
|
||||
column("mitre_technique_name", sa.String),
|
||||
column("techniques", sa.Text),
|
||||
)
|
||||
|
||||
|
||||
def upgrade():
|
||||
bind = op.get_bind()
|
||||
@@ -47,8 +38,8 @@ def upgrade():
|
||||
)
|
||||
|
||||
# 3. Make NOT NULL now that every row has a value.
|
||||
# SQLite doesn't support ALTER COLUMN, so we skip the nullable constraint
|
||||
# change at DDL level — the application model enforces it.
|
||||
with op.batch_alter_table("simulations") as batch_op:
|
||||
batch_op.alter_column("techniques", existing_type=sa.Text(), nullable=False)
|
||||
|
||||
# 4. Drop old scalar columns.
|
||||
with op.batch_alter_table("simulations") as batch_op:
|
||||
|
||||
Reference in New Issue
Block a user