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

fix(github-ids): update all github id's data types to BigInt in schema #159

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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,35 @@
-- DropForeignKey
ALTER TABLE "milestones" DROP CONSTRAINT "milestones_githubRepoId_fkey";

-- DropForeignKey
ALTER TABLE "synced_issues" DROP CONSTRAINT "synced_issues_githubRepoId_fkey";

-- DropForeignKey
ALTER TABLE "syncs" DROP CONSTRAINT "syncs_githubRepoId_fkey";

-- AlterTable
ALTER TABLE "github_repos" ALTER COLUMN "repoId" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "milestones" ALTER COLUMN "githubRepoId" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "synced_issues" ALTER COLUMN "githubIssueNumber" SET DATA TYPE BIGINT,
ALTER COLUMN "githubIssueId" SET DATA TYPE BIGINT,
ALTER COLUMN "githubRepoId" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "syncs" ALTER COLUMN "githubUserId" SET DATA TYPE BIGINT,
ALTER COLUMN "githubRepoId" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "users" ALTER COLUMN "githubUserId" SET DATA TYPE BIGINT;

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

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this migration generated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran prisma migration command pnpm prisma migrate dev

18 changes: 9 additions & 9 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
}

model SyncedIssue {
id String @id @default(cuid())

githubIssueNumber Int
githubIssueNumber BigInt
linearIssueNumber Int

githubIssueId Int
githubIssueId BigInt
linearIssueId String

linearTeamId String
LinearTeam LinearTeam @relation(fields: [linearTeamId], references: [teamId])

githubRepoId Int
githubRepoId BigInt
GitHubRepo GitHubRepo @relation(fields: [githubRepoId], references: [repoId])

@@map("synced_issues")
Expand Down Expand Up @@ -49,7 +49,7 @@ model LinearTeam {
model GitHubRepo {
id String @id @default(cuid())

repoId Int @unique
repoId BigInt @unique
repoName String

webhookSecret String
Expand All @@ -65,11 +65,11 @@ model GitHubRepo {
model Sync {
id String @id @default(cuid())

githubUserId Int
githubUserId BigInt
linearUserId String

GitHubRepo GitHubRepo @relation(fields: [githubRepoId], references: [repoId])
githubRepoId Int
githubRepoId BigInt
githubApiKey String
githubApiKeyIV String

Expand All @@ -85,7 +85,7 @@ model Sync {
model User {
id String @id @default(cuid())

githubUserId Int
githubUserId BigInt
githubUsername String
githubEmail String?

Expand All @@ -104,7 +104,7 @@ model Milestone {
cycleId String

GitHubRepo GitHubRepo @relation(fields: [githubRepoId], references: [repoId])
githubRepoId Int
githubRepoId BigInt

LinearTeam LinearTeam @relation(fields: [linearTeamId], references: [teamId])
linearTeamId String
Expand Down
Loading