Skip to content

Commit a119f2e

Browse files
author
Megan Liu
committed
#1604: made new migration based on change to id field's name
1 parent a49a1b8 commit a119f2e

2 files changed

Lines changed: 27 additions & 12 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `userId` on the `Team` table. All the data in the column will be lost.
5+
6+
*/
7+
-- DropForeignKey
8+
ALTER TABLE "Team" DROP CONSTRAINT "Team_userId_fkey";
9+
10+
-- AlterTable
11+
ALTER TABLE "Team" DROP COLUMN "userId",
12+
ADD COLUMN "userArchivedId" INTEGER;
13+
14+
-- AddForeignKey
15+
ALTER TABLE "Team" ADD CONSTRAINT "Team_userArchivedId_fkey" FOREIGN KEY ("userArchivedId") REFERENCES "User"("userId") ON DELETE SET NULL ON UPDATE CASCADE;

src/backend/src/prisma/schema.prisma

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,18 @@ model User {
120120
}
121121

122122
model Team {
123-
teamId String @id @default(uuid())
124-
teamName String
125-
slackId String
126-
description String @default("")
127-
projects Project[] @relation(name: "assignedBy")
128-
members User[] @relation(name: "teamsAsMember")
129-
leads User[] @relation(name: "teamsAsLead")
130-
headId Int @unique
131-
head User @relation(name: "teamAsHead", fields: [headId], references: [userId])
132-
dateArchived DateTime?
133-
userId Int?
134-
userArchived User? @relation(fields: [userId], references: [userId])
123+
teamId String @id @default(uuid())
124+
teamName String
125+
slackId String
126+
description String @default("")
127+
projects Project[] @relation(name: "assignedBy")
128+
members User[] @relation(name: "teamsAsMember")
129+
leads User[] @relation(name: "teamsAsLead")
130+
headId Int @unique
131+
head User @relation(name: "teamAsHead", fields: [headId], references: [userId])
132+
dateArchived DateTime?
133+
userArchivedId Int?
134+
userArchived User? @relation(fields: [userArchivedId], references: [userId])
135135
}
136136

137137
model Session {

0 commit comments

Comments
 (0)