文件
hyb-oa/server/prisma/migrations/20260307103516_g2_cross_domain_bridge/migration.sql
T

26 行
1.1 KiB
SQL

-- AlterTable
ALTER TABLE "budget_ledger_entries" ADD COLUMN "entity_id" UUID,
ADD COLUMN "entity_type" VARCHAR(32);
-- AlterTable
ALTER TABLE "budget_pools" ADD COLUMN "cost_center_id" UUID,
ADD COLUMN "legal_entity_id" UUID;
-- AlterTable
ALTER TABLE "workflow_instances" ADD COLUMN "purchase_request_id" UUID;
-- CreateIndex
CREATE INDEX "idx_budget_ledger_entity" ON "budget_ledger_entries"("entity_type", "entity_id");
-- CreateIndex
CREATE INDEX "idx_budget_pools_scope_status" ON "budget_pools"("legal_entity_id", "cost_center_id", "status");
-- CreateIndex
CREATE INDEX "workflow_instances_purchase_request_id_idx" ON "workflow_instances"("purchase_request_id");
-- AddForeignKey
ALTER TABLE "budget_pools" ADD CONSTRAINT "budget_pools_legal_entity_id_fkey" FOREIGN KEY ("legal_entity_id") REFERENCES "legal_entities"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "budget_pools" ADD CONSTRAINT "budget_pools_cost_center_id_fkey" FOREIGN KEY ("cost_center_id") REFERENCES "cost_centers"("id") ON DELETE SET NULL ON UPDATE CASCADE;