mafap/server/prisma/schema.prisma

57 lines
1.5 KiB
Plaintext
Raw Normal View History

generator client {
provider = "prisma-client-js"
previewFeatures = ["postgresqlExtensions"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
// My divine intellect has allowed to me to communicate with God.
// These tokens. These are divine tokens.
model GodToken {
token String @unique @db.VarChar(512)
friend Friend? @relation(fields: [friend_id], references: [id])
friend_id Int?
signed Boolean @default(false)
expiration DateTime
}
model Friend {
2023-04-03 15:04:32 -04:00
id Int @id @default(autoincrement())
name String @unique @db.Citext
public_key String @db.Text
2023-04-03 15:04:32 -04:00
referenced_in Timer[] @relation(name: "referenced_friend_fk")
created_timers Timer[] @relation(name: "created_by_fk")
god_tokens GodToken[]
TimerRefreshes TimerRefreshes[]
}
model Timer {
2023-04-03 15:04:32 -04:00
id Int @id @default(autoincrement())
start DateTime? @default(now())
name String @unique
created_by Friend @relation(name: "created_by_fk", fields: [created_by_id], references: [id])
created_by_id Int
timer_refreshes TimerRefreshes[]
2023-04-03 15:04:32 -04:00
referenced_friends Friend[] @relation(name: "referenced_friend_fk")
}
model TimerRefreshes {
2023-04-03 15:04:32 -04:00
id Int @id @default(autoincrement())
start DateTime
end DateTime
2023-04-03 15:04:32 -04:00
refreshed_by Friend @relation(fields: [refreshed_by_id], references: [id])
refreshed_by_id Int
timer Timer @relation(fields: [timer_id], references: [id])
timer_id Int
@@index([end])
}