Skip to content

Commit e1fc69a

Browse files
committed
fix: correctly link featured project skill.
1 parent 0d2be5c commit e1fc69a

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `skillId` on the `SkillForFeaturedProject` table. All the data in the column will be lost.
5+
- Added the required column `skillForUserId` to the `SkillForFeaturedProject` table without a default value. This is not possible if the table is not empty.
6+
7+
*/
8+
-- DropForeignKey
9+
ALTER TABLE "ampdresume"."SkillForFeaturedProject" DROP CONSTRAINT "SkillForFeaturedProject_skillId_fkey";
10+
11+
-- AlterTable
12+
ALTER TABLE "ampdresume"."SkillForFeaturedProject" DROP COLUMN "skillId",
13+
ADD COLUMN "skillForUserId" TEXT NOT NULL;
14+
15+
-- AddForeignKey
16+
ALTER TABLE "ampdresume"."SkillForFeaturedProject" ADD CONSTRAINT "SkillForFeaturedProject_skillForUserId_fkey" FOREIGN KEY ("skillForUserId") REFERENCES "ampdresume"."SkillForUser"("id") ON DELETE CASCADE ON UPDATE CASCADE;

prisma/schema.prisma

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,12 @@ model Social {
107107
/// Skill is a general skill that can be used by multiple users, e.g. "HTML", "CSS", "JavaScript"
108108
/// Not limited to technical skills. Can be used for any skill, e.g. "Public Speaking", "Leadership"
109109
model Skill {
110-
id String @id @default(cuid())
110+
id String @id @default(cuid())
111111
/// Ensures skill names are unique
112-
name String @unique
112+
name String @unique
113113
/// Optional icon, e.g., from Iconify
114-
icon String?
115-
skillForUser SkillForUser[]
116-
SkillForFeaturedProject SkillForFeaturedProject[]
114+
icon String?
115+
skillForUser SkillForUser[]
117116
118117
@@schema("ampdresume")
119118
}
@@ -122,20 +121,21 @@ model Skill {
122121
/// The custom data is specific to the user's resume. The skill itself is a general skill
123122
/// that can be used by multiple users.
124123
model SkillForUser {
125-
id String @id @default(cuid())
126-
skillId String
127-
userId String
124+
id String @id @default(cuid())
125+
skillId String
126+
userId String
128127
/// Optional meta about the skill for this user
129-
description String?
128+
description String?
130129
/// Optional icon, e.g., from Iconify, overrides the icon in Skill if found
131-
icon String?
130+
icon String?
132131
/// Optional start year of using the skill
133-
yearStarted Int?
132+
yearStarted Int?
134133
/// Optional total years using the skill
135-
totalYears Int?
136-
skillForProject SkillForProject[]
137-
skill Skill @relation(fields: [skillId], references: [id], onDelete: Cascade)
138-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
134+
totalYears Int?
135+
skillForProject SkillForProject[]
136+
skill Skill @relation(fields: [skillId], references: [id], onDelete: Cascade)
137+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
138+
SkillForFeaturedProject SkillForFeaturedProject[]
139139
140140
@@unique([userId, skillId])
141141
@@schema("ampdresume")
@@ -207,8 +207,8 @@ model Company {
207207
model SkillForFeaturedProject {
208208
id String @id @default(cuid())
209209
description String?
210-
skillId String
211-
skill Skill @relation(fields: [skillId], references: [id], onDelete: Cascade)
210+
skillForUserId String
211+
skillForUser SkillForUser @relation(fields: [skillForUserId], references: [id], onDelete: Cascade)
212212
featuredProjectId String
213213
featuredProject FeaturedProject @relation(fields: [featuredProjectId], references: [id], onDelete: Cascade)
214214

0 commit comments

Comments
 (0)