R57 A1-A6:报销模板与差旅申请关联

这个提交包含在:
2026-04-08 21:16:30 +08:00
父节点 14c2cbd6da
当前提交 88c987ae8f
共修改 17 个文件,包含 2886 行新增和 76 行删除
@@ -0,0 +1,28 @@
CREATE TABLE "reimbursement_templates" (
"id" UUID NOT NULL,
"name" VARCHAR(100) NOT NULL,
"description" TEXT,
"items" JSONB NOT NULL DEFAULT '[]',
"sort_order" INTEGER NOT NULL DEFAULT 0,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"created_by" UUID,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_by" UUID,
CONSTRAINT "reimbursement_templates_pkey" PRIMARY KEY ("id")
);
CREATE INDEX "reimbursement_templates_enabled_sort_order_idx"
ON "reimbursement_templates"("enabled", "sort_order");
ALTER TABLE "reimbursement_forms"
ADD COLUMN "linked_travel_request_id" UUID;
CREATE INDEX "idx_reimbursement_forms_linked_travel_request"
ON "reimbursement_forms"("linked_travel_request_id");
ALTER TABLE "reimbursement_forms"
ADD CONSTRAINT "reimbursement_forms_linked_travel_request_id_fkey"
FOREIGN KEY ("linked_travel_request_id") REFERENCES "travel_requests"("id")
ON DELETE SET NULL ON UPDATE CASCADE;