Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ datasource db {
model Comment {
content String?
id Int @default(autoincrement()) @id
postId Int @unique
userId Int @unique
postId Int
userId Int
Post Post @relation(fields: [postId], references: [id])
User User @relation(fields: [userId], references: [id])
}
Expand All @@ -28,10 +28,10 @@ model Post {
}

model User {
email String @unique
id Int @default(autoincrement()) @id
email String @unique
id Int @default(autoincrement()) @id
name String?
password String?
Comment Comment?
Comment Comment[]
Post Post[]
}
}
4 changes: 2 additions & 2 deletions prisma/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ CREATE TABLE "public"."Post" (
CREATE TABLE "public"."Comment" (
id SERIAL PRIMARY KEY NOT NULL,
content TEXT,
"userId" INTEGER UNIQUE NOT NULL,
"postId" INTEGER UNIQUE NOT NULL,
"userId" INTEGER NOT NULL,
"postId" INTEGER NOT NULL,
FOREIGN KEY ("userId") REFERENCES "public"."User"(id),
FOREIGN KEY ("postId") REFERENCES "public"."Post"(id)
);