Skip to content

Commit

Permalink
fix: delete unneccesary foreignt key in first migration that is later…
Browse files Browse the repository at this point in the history
… removed. let us just remove both instead.
  • Loading branch information
irony committed Nov 13, 2024
1 parent 69aab74 commit 0b20eec
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
/*
Warnings:
- You are about to drop the column `reportingPeriodId` on the `Goal` table. All the data in the column will be lost.
- You are about to drop the column `reportingPeriodId` on the `Initiative` table. All the data in the column will be lost.
- The primary key for the `ReportingPeriod` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `id` on the `ReportingPeriod` table. All the data in the column will be lost.
- Added the required column `year` to the `ReportingPeriod` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Goal" DROP CONSTRAINT "Goal_reportingPeriodId_fkey";

-- DropForeignKey
ALTER TABLE "Initiative" DROP CONSTRAINT "Initiative_reportingPeriodId_fkey";

-- AlterTable
ALTER TABLE "Goal" DROP COLUMN "reportingPeriodId";

Expand All @@ -28,9 +20,3 @@ ALTER TABLE "ReportingPeriod" ALTER COLUMN "year" SET NOT NULL;
ALTER TABLE "ReportingPeriod" DROP CONSTRAINT "ReportingPeriod_pkey",
DROP COLUMN "id",
ADD CONSTRAINT "ReportingPeriod_pkey" PRIMARY KEY ("companyId", "year");

-- AddForeignKey
ALTER TABLE "Goal" ADD CONSTRAINT "Goal_companyId_year_fkey" FOREIGN KEY ("companyId", "year") REFERENCES "ReportingPeriod"("companyId", "year") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Initiative" ADD CONSTRAINT "Initiative_companyId_year_fkey" FOREIGN KEY ("companyId", "year") REFERENCES "ReportingPeriod"("companyId", "year") ON DELETE RESTRICT ON UPDATE CASCADE;

This file was deleted.

0 comments on commit 0b20eec

Please sign in to comment.