lume/src-tauri/prisma/schema.prisma
2023-04-10 15:50:38 +07:00

104 lines
2.1 KiB
Plaintext

datasource db {
provider = "sqlite"
url = "file:../../lume.db"
}
generator client {
provider = "cargo prisma"
// The location to generate the client. Is relative to the position of the schema
output = "../src/db.rs"
module_path = "db"
}
model Account {
id Int @id @default(autoincrement())
pubkey String @unique
privkey String @unique
active Boolean @default(false)
metadata String
// related
plebs Pleb[]
messages Message[]
notes Note[]
chats Chat[]
channels Channel[]
@@index([pubkey])
}
model Pleb {
id Int @id @default(autoincrement())
plebId String @unique
pubkey String
kind Int
metadata String
Account Account @relation(fields: [accountId], references: [id])
accountId Int
}
model Note {
id Int @id @default(autoincrement())
eventId String @unique
pubkey String
kind Int
tags String
content String
parent_id String
parent_comment_id String
createdAt Int
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([eventId, createdAt])
}
model Message {
id Int @id @default(autoincrement())
pubkey String
content String
tags String
createdAt Int
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([pubkey, createdAt])
}
model Chat {
id Int @id @default(autoincrement())
pubkey String @unique
createdAt Int
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([pubkey])
}
model Channel {
id Int @id @default(autoincrement())
eventId String @unique
content String
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([eventId])
}
model Relay {
id Int @id @default(autoincrement())
url String
active Boolean @default(true)
}
model Setting {
id Int @id @default(autoincrement())
key String
value String
}