Unveränderter Stand von certvia/dev (a48c5fb) plus Craftvia-Spezifikation und Brandbook unter docs/craftvia/. ISMS-Module werden im Folgecommit entfernt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
36 lines
1.6 KiB
SQL
36 lines
1.6 KiB
SQL
-- CreateTable
|
|
CREATE TABLE "process_dependencies" (
|
|
"id" TEXT NOT NULL,
|
|
"tenant_id" TEXT NOT NULL,
|
|
"source_process_id" TEXT NOT NULL,
|
|
"target_process_id" TEXT NOT NULL,
|
|
"note" TEXT,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "process_dependencies_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "process_dependencies_tenant_id_idx" ON "process_dependencies"("tenant_id");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "process_dependencies_target_process_id_idx" ON "process_dependencies"("target_process_id");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "process_dependencies_source_process_id_target_process_id_key" ON "process_dependencies"("source_process_id", "target_process_id");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "process_dependencies" ADD CONSTRAINT "process_dependencies_source_process_id_fkey" FOREIGN KEY ("source_process_id") REFERENCES "processes"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "process_dependencies" ADD CONSTRAINT "process_dependencies_target_process_id_fkey" FOREIGN KEY ("target_process_id") REFERENCES "processes"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- Row Level Security: Mandantentrennung (analog übrige tenant-scoped Tabellen)
|
|
ALTER TABLE "process_dependencies" ENABLE ROW LEVEL SECURITY;
|
|
|
|
CREATE POLICY tenant_isolation ON "process_dependencies"
|
|
USING ("tenant_id" = current_setting('app.tenant_id', true))
|
|
WITH CHECK ("tenant_id" = current_setting('app.tenant_id', true));
|
|
ALTER TABLE "process_dependencies" FORCE ROW LEVEL SECURITY;
|