feat(server): 试运行性能索引补强(E9)
- reimbursement_forms/invoice_pool/workflow_tasks/audit_logs 增加常用筛选组合索引 - 仅新增索引与迁移,便于回滚
这个提交包含在:
@@ -0,0 +1,20 @@
|
||||
-- DropIndex
|
||||
DROP INDEX "idx_audit_logs_query";
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "idx_audit_logs_query" ON "audit_logs"("created_at", "actor_id", "action");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "idx_audit_logs_target_type_created_at" ON "audit_logs"("target_type", "created_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "idx_invoice_pool_owner_status_created_at" ON "invoice_pool"("owner_employee_id", "status", "created_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "idx_reimbursement_owner_status_updated_at" ON "reimbursement_forms"("owner_id", "status", "updated_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "idx_workflow_tasks_status_assignee_id_created_at" ON "workflow_tasks"("status", "assignee_id", "created_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "idx_workflow_tasks_status_assignee_role_created_at" ON "workflow_tasks"("status", "assignee_role", "created_at");
|
||||
@@ -278,6 +278,7 @@ model AuditLog {
|
||||
@@index([request_id])
|
||||
@@index([actor_id, created_at])
|
||||
@@index([created_at, actor_id, action], map: "idx_audit_logs_query")
|
||||
@@index([target_type, created_at], map: "idx_audit_logs_target_type_created_at")
|
||||
@@map("audit_logs")
|
||||
}
|
||||
|
||||
@@ -356,6 +357,7 @@ model ReimbursementForm {
|
||||
@@index([paid_by])
|
||||
@@index([status])
|
||||
@@index([reimbursement_date])
|
||||
@@index([owner_id, status, updated_at], map: "idx_reimbursement_owner_status_updated_at")
|
||||
@@map("reimbursement_forms")
|
||||
}
|
||||
|
||||
@@ -459,6 +461,7 @@ model InvoicePool {
|
||||
@@index([invoice_code, invoice_number])
|
||||
@@index([status])
|
||||
@@index([status, ocr_locked_at, created_at], map: "idx_invoice_pool_ocr_queue")
|
||||
@@index([owner_employee_id, status, created_at], map: "idx_invoice_pool_owner_status_created_at")
|
||||
@@index([linked_reimbursement_id])
|
||||
@@map("invoice_pool")
|
||||
}
|
||||
@@ -543,6 +546,8 @@ model WorkflowTask {
|
||||
@@index([assignee_id])
|
||||
@@index([assignee_role])
|
||||
@@index([status, assignee_id, assignee_role], map: "idx_workflow_tasks_status_assignee")
|
||||
@@index([status, assignee_id, created_at], map: "idx_workflow_tasks_status_assignee_id_created_at")
|
||||
@@index([status, assignee_role, created_at], map: "idx_workflow_tasks_status_assignee_role_created_at")
|
||||
@@map("workflow_tasks")
|
||||
}
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户