lume/src-tauri/prisma/schema.prisma

104 lines
2.1 KiB
Plaintext
Raw Normal View History

datasource db {
provider = "sqlite"
url = "file:../../lume.db"
}
generator client {
2023-04-02 09:22:50 +00:00
provider = "cargo prisma"
// The location to generate the client. Is relative to the position of the schema
2023-04-02 09:22:50 +00:00
output = "../src/db.rs"
module_path = "db"
}
model Account {
id Int @id @default(autoincrement())
2023-04-05 08:38:41 +00:00
pubkey String @unique
2023-04-02 09:22:50 +00:00
privkey String @unique
active Boolean @default(false)
metadata String
// related
2023-04-05 08:38:41 +00:00
plebs Pleb[]
2023-04-02 09:22:50 +00:00
messages Message[]
notes Note[]
2023-04-10 08:50:38 +00:00
chats Chat[]
channels Channel[]
2023-04-02 09:22:50 +00:00
@@index([pubkey])
}
2023-04-05 08:38:41 +00:00
model Pleb {
2023-04-02 09:22:50 +00:00
id Int @id @default(autoincrement())
plebId String @unique
pubkey String
2023-04-02 09:22:50 +00:00
kind Int
metadata String
Account Account @relation(fields: [accountId], references: [id])
accountId Int
}
model Note {
id Int @id @default(autoincrement())
eventId String @unique
2023-04-02 09:22:50 +00:00
pubkey String
kind Int
tags String
content String
parent_id String
parent_comment_id String
createdAt Int
2023-04-02 09:22:50 +00:00
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([eventId, createdAt])
2023-04-02 09:22:50 +00:00
}
model Message {
id Int @id @default(autoincrement())
2023-04-02 09:22:50 +00:00
pubkey String
content String
tags String
createdAt Int
2023-04-02 09:22:50 +00:00
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([pubkey, createdAt])
2023-04-02 09:22:50 +00:00
}
2023-04-10 08:50:38 +00:00
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
2023-04-10 08:50:38 +00:00
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([eventId])
}
2023-04-02 09:22:50 +00:00
model Relay {
id Int @id @default(autoincrement())
url String
active Boolean @default(true)
}
model Setting {
id Int @id @default(autoincrement())
key String
value String
}