Skip to content

Commit c4eb7b9

Browse files
committed
feat: rename social columns.
1 parent 48e6d39 commit c4eb7b9

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `name` on the `Social` table. All the data in the column will be lost.
5+
- You are about to drop the column `url` on the `Social` table. All the data in the column will be lost.
6+
- Added the required column `platform` to the `Social` table without a default value. This is not possible if the table is not empty.
7+
- Added the required column `ref` to the `Social` table without a default value. This is not possible if the table is not empty.
8+
9+
*/
10+
-- AlterTable
11+
ALTER TABLE "openresume"."Social" DROP COLUMN "name",
12+
DROP COLUMN "url",
13+
ADD COLUMN "platform" TEXT NOT NULL,
14+
ADD COLUMN "ref" TEXT NOT NULL;

prisma/schema.prisma

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,11 @@ model VerificationToken {
8080

8181
// Social media links for a user, e.g. "Twitter", "GitHub", "LinkedIn"
8282
model Social {
83-
id String @id @default(cuid())
84-
name String
85-
// URL base dpends on the name, e.g. "https://{name}.com/{username}"
86-
// So, if name is "twitter", and username is "jack", the full URL will be "https://twitter.com/jack"
87-
// Or if it's LinkedIn, it will be "https://linkedin.com/in/{username}"
88-
// However, if the name is "website" or "personal", then the URL should be the full URL.
89-
url String
90-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
91-
userId String
83+
id String @id @default(cuid())
84+
platform String
85+
ref String
86+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
87+
userId String
9288
9389
@@schema("openresume")
9490
}

prisma/seed/social.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ export async function seedSocials() {
1212

1313
const socials = [
1414
{
15-
name: "GitHub",
16-
url: "missionmike",
15+
platform: "github",
16+
ref: "missionmike",
1717
},
1818
{
19-
name: "LinkedIn",
20-
url: "michael-dinerstein",
19+
platform: "linkedin",
20+
ref: "michael-dinerstein",
2121
},
2222
{
23-
name: "X",
24-
url: "missionmikedev",
23+
platform: "x",
24+
ref: "missionmikedev",
2525
},
2626
{
27-
name: "Website",
28-
url: "https://www.missionmike.dev",
27+
platform: "website",
28+
ref: "https://www.missionmike.dev",
2929
},
3030
];
3131

@@ -44,7 +44,9 @@ export async function seedSocials() {
4444
...social,
4545
},
4646
});
47-
console.log(`Created social ${social.name} for user ${userId} with id: ${createdSocial.id}`);
47+
console.log(
48+
`Created social ${social.platform} for user ${userId} with id: ${createdSocial.id}`,
49+
);
4850
}
4951
}
5052
}

0 commit comments

Comments
 (0)