Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds DB migration to create milestones table and unique index for syncs. #131

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Warnings:
- A unique constraint covering the columns `[githubUserId,linearUserId,githubRepoId,linearTeamId]` on the table `syncs` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateTable
CREATE TABLE "milestones" (
"id" TEXT NOT NULL,
"milestoneId" INTEGER NOT NULL,
"cycleId" TEXT NOT NULL,
"githubRepoId" INTEGER NOT NULL,
"linearTeamId" TEXT NOT NULL,

CONSTRAINT "milestones_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "milestones_milestoneId_githubRepoId_cycleId_linearTeamId_key" ON "milestones"("milestoneId", "githubRepoId", "cycleId", "linearTeamId");

-- CreateIndex
CREATE UNIQUE INDEX "syncs_githubUserId_linearUserId_githubRepoId_linearTeamId_key" ON "syncs"("githubUserId", "linearUserId", "githubRepoId", "linearTeamId");

-- AddForeignKey
ALTER TABLE "milestones" ADD CONSTRAINT "milestones_githubRepoId_fkey" FOREIGN KEY ("githubRepoId") REFERENCES "github_repos"("repoId") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "milestones" ADD CONSTRAINT "milestones_linearTeamId_fkey" FOREIGN KEY ("linearTeamId") REFERENCES "linear_teams"("teamId") ON DELETE RESTRICT ON UPDATE CASCADE;