37 lines
894 B
Plaintext
37 lines
894 B
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
username String @unique
|
|
password String
|
|
name String?
|
|
posts Post[] @relation("UserPosts")
|
|
likes Post[] @relation("UserLikes")
|
|
following User[] @relation("UserFollows")
|
|
followedBy User[] @relation("UserFollows")
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Post {
|
|
id Int @id @default(autoincrement())
|
|
text String
|
|
author User @relation("UserPosts", fields: [userId], references: [id])
|
|
userId Int
|
|
likes User[] @relation("UserLikes")
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|