wip: convert tauri sql to prisma

This commit is contained in:
Ren Amamiya
2023-04-02 16:22:50 +07:00
parent 9b8a96c651
commit 39e7c9bf34
11 changed files with 228 additions and 162 deletions

View File

@@ -1,11 +1,75 @@
datasource db {
provider = "sqlite"
url = "file:lume.db"
url = "file:../lume.db"
}
generator client {
// Corresponds to the cargo alias created earlier
provider = "cargo prisma"
provider = "cargo prisma"
// The location to generate the client. Is relative to the position of the schema
output = "../src/prisma.rs"
output = "../src/db.rs"
module_path = "db"
}
model Account {
id Int @id @default(autoincrement())
pubkey String
privkey String @unique
active Boolean @default(false)
metadata String
// related
follows Follow[]
messages Message[]
notes Note[]
@@index([pubkey])
}
model Follow {
id Int @id @default(autoincrement())
pubkey String
kind Int
metadata String
Account Account @relation(fields: [accountId], references: [id])
accountId Int
}
model Note {
id Int @id @default(autoincrement())
pubkey String
kind Int
tags String
content String
parent_id String
parent_comment_id String
createdAt DateTime @default(now())
Account Account @relation(fields: [accountId], references: [id])
accountId Int
}
model Message {
id Int @id @default(autoincrement())
pubkey String
content String
tags String
createdAt DateTime @default(now())
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([pubkey])
}
model Relay {
id Int @id @default(autoincrement())
url String
active Boolean @default(true)
}
model Setting {
id Int @id @default(autoincrement())
key String
value String
}