Files
server/prisma/schema.prisma
AtHeartEngineer 170cb46d07 checkpoint
2024-03-27 13:23:32 -04:00

128 lines
3.4 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum MembershipType {
IDENTITY_LIST
}
enum RoomType {
PUBLIC
PRIVATE
}
enum Ephemeral {
PERSISTENT
EPHEMERAL
}
enum Encrypted {
PLAINTEXT
AES
}
model Rooms {
id Int @id @default(autoincrement())
roomId String @unique
name String
rateLimit Int @default(10000)
banRateLimit Int @default(1000000)
userMessageLimit Int @default(12)
membershipType MembershipType @default(IDENTITY_LIST)
adminIdentities String[]
identities String[]
contractAddress String?
bandadaAddress String?
bandadaGroupId String?
bandadaAPIKey String?
type RoomType @default(PUBLIC)
ephemeral Ephemeral @default(PERSISTENT)
encrypted Encrypted @default(PLAINTEXT)
passwordHash String?
claimCodes ClaimCodes[] @relation("RoomClaimCodes")
gateways UserIdentity[] @relation("RoomIdentity")
ethereumGroups EthereumGroup[] @relation("RoomEthereumGroup")
Epoch Epoch[]
}
model UserIdentity {
id Int @id @default(autoincrement())
semaphoreIdentity String @unique
discordId String?
jubmoji String[]
steamId64 String?
rooms Rooms[] @relation("RoomIdentity")
claimCodes ClaimCodes[]
ethereumAddress EthereumAddress[]
}
model EthereumGroup {
id Int @id @default(autoincrement())
name String @unique
rooms Rooms[] @relation("RoomEthereumGroup")
ethereumAddresses String[]
}
model EthereumAddress {
id Int @id @default(autoincrement())
ethereumAddress String @unique
gateways UserIdentity @relation(fields: [gateWayIdentityId], references: [id])
gateWayIdentityId Int
}
model ClaimCodes {
id Int @id @default(autoincrement())
claimcode String @unique
expiresAt DateTime @default("1970-01-01T00:00:00Z")
usesLeft Int @default(-1)
rooms Rooms[] @relation("RoomClaimCodes")
discordId String?
gateways UserIdentity[]
}
model Messages {
id Int @id @default(autoincrement())
messageId String
message String
timeStamp DateTime @default(now())
messageType String? @default("TEXT")
proof String
epoch Epoch? @relation(fields: [epochId], references: [id])
epochId Int?
sessionId String @default("")
responseTo String? @default("")
encrypted Encrypted @default(PLAINTEXT)
@@index(fields: [messageId])
}
model Epoch {
id Int @id @default(autoincrement())
epoch String
messages Messages[]
rooms Rooms? @relation(fields: [roomsId], references: [roomId])
roomsId String?
@@index(fields: [epoch])
}
model Discord {
id Int @id @default(autoincrement())
discordServerId String @unique
roomsMapping DiscordRoleRoomMapping[]
}
model DiscordRoleRoomMapping {
id Int @id @default(autoincrement())
discordServerId String
roomId String @unique
roles String[]
discord Discord @relation(fields: [discordId], references: [id])
discordId Int
}