basquetWi + New ticket

New ticket

Sub-ticket of MARS-205 periodos deletedAt/isActive invariant trigger (mig016): a soft-deleted periodo could coexist with isActive=true (archive trigger is archive-only, never clears isActive), so isActive-only reads could surface a deleted periodo. Elazar's root-fix = enforce the invariant at source via BEFORE UPDATE trigger: deletedAt NULL→NOT NULL forces isActive=false; restore (deletedAt→NULL) does NOT auto-activate (admin sets deliberately). Scope: periodos is the ONLY table with both columns; 0 existing violations (no data repair). fn_periodos_enforce_isactive + trg_periodos_enforce_isactive, runs before trg_periodos_archive (alphabetical) so archive row captures isActive=false. Supersedes MARS-203 item-4 (periodo read-patches no longer needed). Audit pre-apply DDL review then db applies via MCP. · mars