Commit Graph

1 Commits

Author SHA1 Message Date
ac41d5e0d8 [CLAUDE] Scripts: SQL clean transactional UAT (Session 17 V2 testing)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m12s
User UAT V2 schema cần clean phiếu cũ trên prod để đỡ rối mắt + giữ
master data (Users / Suppliers / Projects / Departments / Workflows).

scripts/sql/clean-transactional-uat.sql:
- DELETE theo FK order (child → parent):
  1. PE child rows (DeptApprovals/Opinions/Attachments/Changelogs/
     Approvals/Quotes/Details/Suppliers)
  2. PE main (giải phóng FK PE.ContractId/BudgetId)
  3. Contract per-type Details (7 bảng) + Contract child rows
  4. Contract main
  5. Budget child rows + main
  6. CodeSequences (PE + Contract reset)
  7. Notifications (dangling refs sau khi xóa phiếu)
- Wrap BEGIN/COMMIT TRANSACTION
- Verify queries cuối in count master KEEP + transactional after-clean

KEEP master: Users, Roles, MenuItems, Permissions, Suppliers, Projects,
Departments, UnitsOfMeasure, MaterialItems, ServiceItems, WorkItems,
ContractTemplates, ContractClauses, WorkflowTypeAssignments,
WorkflowDefinitions (V1 legacy), PurchaseEvaluationWorkflowDefinitions,
ApprovalWorkflows + Steps + Levels (V2 Mig 22).

Required SET QUOTED_IDENTIFIER ON; ANSI_NULLS ON; cho filtered indexes
Mig 19/20 (sqlcmd default off → DELETE fail).

Verify local Dev: chạy OK, 1 Contract + 0 PE + 0 Budget cleaned, master
giữ (Users=2 admin seed, Suppliers=3, Projects=1, Departments=9, V1
WfDef=7).
2026-05-08 15:28:40 +07:00