2022-02-15 10:06:36 +00:00
|
|
|
|
// This is your Prisma schema file,
|
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
datasource db {
|
2022-02-20 08:25:30 +00:00
|
|
|
|
provider = "postgresql"
|
|
|
|
|
url = env("DATABASE_URL")
|
2022-02-15 10:06:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-24 13:16:19 +00:00
|
|
|
|
model Session {
|
2022-03-07 08:36:13 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
dcId Int?
|
|
|
|
|
port Int?
|
|
|
|
|
serverAddress String?
|
|
|
|
|
authKey Bytes?
|
|
|
|
|
entities Entity[]
|
2022-02-24 13:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Entity {
|
2022-03-07 08:36:13 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
2022-02-24 13:16:19 +00:00
|
|
|
|
// 源代码里面大概支持 string 和 BigInteger,不如先全都存 String
|
2022-03-07 08:36:13 +00:00
|
|
|
|
entityId String
|
|
|
|
|
sessionId Int
|
2022-03-08 06:12:22 +00:00
|
|
|
|
session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
2022-03-07 08:36:13 +00:00
|
|
|
|
hash String?
|
|
|
|
|
username String?
|
|
|
|
|
phone String?
|
|
|
|
|
name String?
|
2022-02-24 13:16:19 +00:00
|
|
|
|
|
|
|
|
|
@@unique([entityId, sessionId])
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-07 08:36:13 +00:00
|
|
|
|
model Instance {
|
2022-12-23 06:34:25 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
owner BigInt @default(0)
|
|
|
|
|
workMode String @default("")
|
|
|
|
|
isSetup Boolean @default(false)
|
|
|
|
|
Message Message[]
|
|
|
|
|
ForwardPair ForwardPair[]
|
|
|
|
|
botSessionId Int?
|
|
|
|
|
userSessionId Int?
|
|
|
|
|
qqBotId Int?
|
|
|
|
|
qqBot QqBot? @relation(fields: [qqBotId], references: [id], onDelete: Cascade)
|
2022-12-23 08:41:20 +00:00
|
|
|
|
reportUrl String?
|
2022-12-23 06:34:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model QqBot {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
uin BigInt @default(0)
|
|
|
|
|
password String @default("")
|
|
|
|
|
platform Int @default(0)
|
|
|
|
|
Instance Instance[]
|
2022-03-07 08:36:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 10:06:36 +00:00
|
|
|
|
model Message {
|
2022-02-23 09:11:04 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
2022-03-07 08:36:13 +00:00
|
|
|
|
qqRoomId BigInt @db.BigInt
|
|
|
|
|
qqSenderId BigInt @db.BigInt
|
2022-02-24 10:27:06 +00:00
|
|
|
|
time Int
|
2022-02-24 13:16:19 +00:00
|
|
|
|
brief String?
|
2022-02-23 09:11:04 +00:00
|
|
|
|
seq Int
|
2022-12-23 07:10:37 +00:00
|
|
|
|
rand BigInt @db.BigInt
|
2022-02-23 09:11:04 +00:00
|
|
|
|
pktnum Int
|
2022-03-07 08:36:13 +00:00
|
|
|
|
tgChatId BigInt @db.BigInt
|
2022-02-23 09:11:04 +00:00
|
|
|
|
tgMsgId Int
|
2022-03-07 08:36:13 +00:00
|
|
|
|
instanceId Int @default(0)
|
2022-03-08 06:12:22 +00:00
|
|
|
|
instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
2022-02-15 15:23:03 +00:00
|
|
|
|
|
2022-03-21 03:22:57 +00:00
|
|
|
|
@@index([qqRoomId, qqSenderId, seq, rand, pktnum, time, instanceId])
|
2022-03-13 05:57:45 +00:00
|
|
|
|
@@index([tgChatId, tgMsgId, instanceId])
|
2022-02-15 15:23:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model ForwardPair {
|
2022-02-23 09:11:04 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
2022-03-07 12:58:56 +00:00
|
|
|
|
qqRoomId BigInt @db.BigInt
|
|
|
|
|
tgChatId BigInt @db.BigInt
|
2022-02-24 13:16:19 +00:00
|
|
|
|
avatarCache AvatarCache[]
|
2022-03-07 08:36:13 +00:00
|
|
|
|
instanceId Int @default(0)
|
2022-03-08 06:12:22 +00:00
|
|
|
|
instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
2022-04-07 05:32:15 +00:00
|
|
|
|
joinNotice Boolean @default(true)
|
|
|
|
|
poke Boolean @default(true)
|
2022-08-14 04:09:30 +00:00
|
|
|
|
enable Boolean @default(true)
|
2022-10-17 13:19:24 +00:00
|
|
|
|
disableQ2TG Boolean @default(false)
|
|
|
|
|
disableTG2Q Boolean @default(false)
|
2022-03-07 12:58:56 +00:00
|
|
|
|
|
|
|
|
|
@@unique([qqRoomId, instanceId])
|
|
|
|
|
@@unique([tgChatId, instanceId])
|
2022-02-15 15:23:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model File {
|
2022-03-07 08:36:13 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
roomId BigInt @db.BigInt
|
|
|
|
|
fileId String
|
|
|
|
|
info String
|
2022-02-15 15:23:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model FlashPhoto {
|
2022-03-07 08:36:13 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
2022-02-23 09:11:04 +00:00
|
|
|
|
photoMd5 String
|
2022-03-07 08:36:13 +00:00
|
|
|
|
views FlashPhotoView[]
|
2022-02-15 10:06:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 15:23:03 +00:00
|
|
|
|
model FlashPhotoView {
|
2022-03-07 08:36:13 +00:00
|
|
|
|
id Int @id @default(autoincrement())
|
2022-02-23 09:11:04 +00:00
|
|
|
|
flashPhotoId Int
|
2022-03-07 08:36:13 +00:00
|
|
|
|
flashPhoto FlashPhoto @relation(fields: [flashPhotoId], references: [id])
|
|
|
|
|
viewerId BigInt @db.BigInt
|
2022-02-15 15:23:03 +00:00
|
|
|
|
|
|
|
|
|
@@unique([flashPhotoId, viewerId])
|
|
|
|
|
}
|
2022-02-23 09:11:04 +00:00
|
|
|
|
|
|
|
|
|
model AvatarCache {
|
|
|
|
|
id Int @id @default(autoincrement())
|
2022-03-08 06:12:22 +00:00
|
|
|
|
forwardPair ForwardPair @relation(fields: [forwardPairId], references: [id], onDelete: Cascade)
|
2022-02-23 09:11:04 +00:00
|
|
|
|
forwardPairId Int @unique
|
2022-03-02 11:40:51 +00:00
|
|
|
|
hash Bytes
|
2022-02-23 09:11:04 +00:00
|
|
|
|
}
|