file-uploader/prisma/schema.prisma

57 lines
1.3 KiB
Text
Raw Normal View History

2024-03-24 06:18:11 +00:00
datasource db {
2024-04-29 13:44:00 +00:00
provider = "mysql"
url = env("DATABASE_URL")
2024-03-24 06:18:11 +00:00
}
generator client {
2024-04-29 13:44:00 +00:00
provider = "prisma-client-js"
2024-03-24 06:18:11 +00:00
}
2024-03-24 06:36:41 +00:00
model User {
2024-04-29 13:44:00 +00:00
id Int @id @default(autoincrement())
username String @unique
email String @unique
password String
createdAt DateTime @default(now())
lastSeen DateTime @default(now())
settings UserSettings?
// STORED AS MEGABYTES !!
maxUpload Int @default(100)
uploads Upload[]
sessions Session[]
2024-04-02 04:08:49 +00:00
}
model Session {
2024-04-29 13:44:00 +00:00
id String @id @unique
user User @relation(fields: [userId], references: [id])
userId Int
authorized Boolean
createdAt DateTime @default(now())
expiresAt DateTime
remoteAddress String?
2024-03-24 06:36:41 +00:00
}
model UserSettings {
2024-04-29 13:44:00 +00:00
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int @unique
2024-03-24 06:36:41 +00:00
2024-04-29 13:44:00 +00:00
newPostsPublic Boolean @default(false)
linkToRaw Boolean @default(false)
embedTitle String
embedDescription String
embedColor Int
2024-03-24 06:36:41 +00:00
}
model Upload {
2024-04-29 13:44:00 +00:00
id String @id
2024-03-24 06:36:41 +00:00
2024-04-29 13:44:00 +00:00
uploader User @relation(fields: [uploaderId], references: [id])
uploaderId Int
2024-03-24 06:36:41 +00:00
2024-04-29 13:44:00 +00:00
fileName String @unique
public Boolean @default(false)
uploaded DateTime @default(now())
2024-03-24 06:36:41 +00:00
}