From 007e42a2e62099ae8552ce6a1512a2ebd037626b Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Sat, 12 Aug 2023 00:04:01 +0200 Subject: [PATCH] Re-add constraints (#1177) --- .../migration.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 server/src/database/migrations/20230811193858_add_missing_constraints/migration.sql diff --git a/server/src/database/migrations/20230811193858_add_missing_constraints/migration.sql b/server/src/database/migrations/20230811193858_add_missing_constraints/migration.sql new file mode 100644 index 0000000000..63060a14b6 --- /dev/null +++ b/server/src/database/migrations/20230811193858_add_missing_constraints/migration.sql @@ -0,0 +1,17 @@ +-- DropForeignKey +ALTER TABLE "activity_targets" DROP CONSTRAINT "activity_targets_companyId_fkey"; + +-- DropForeignKey +ALTER TABLE "activity_targets" DROP CONSTRAINT "activity_targets_personId_fkey"; + +-- AddForeignKey +ALTER TABLE "activity_targets" ADD CONSTRAINT "activity_targets_personId_fkey" FOREIGN KEY ("personId") REFERENCES "people"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "activity_targets" ADD CONSTRAINT "activity_targets_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "companies"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "companies"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_personId_fkey" FOREIGN KEY ("personId") REFERENCES "people"("id") ON DELETE CASCADE ON UPDATE CASCADE;