230 lines
7.9 KiB
Plaintext
230 lines
7.9 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
previewFeatures = ["views"]
|
|
}
|
|
|
|
generator dbml {
|
|
provider = "prisma-dbml-generator"
|
|
output = "../src"
|
|
outputName = "schema.dbml"
|
|
projectDatabaseType = "mysql"
|
|
projectName = "BKON Wallet Schema"
|
|
projectNote = "BKON Wallet Distributor Table"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "mysql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Board {
|
|
id Int @id @default(autoincrement())
|
|
title String?
|
|
body String? @db.Text
|
|
imgUrl String?
|
|
count Int @default(0)
|
|
categoryId Int?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
link String?
|
|
category Category? @relation(fields: [categoryId], references: [id])
|
|
|
|
@@index([title], map: "title")
|
|
@@index([categoryId], map: "Board_categoryId_fkey")
|
|
}
|
|
|
|
model Category {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
Board Board[]
|
|
}
|
|
|
|
model Node {
|
|
id Int @id @default(autoincrement())
|
|
address String @unique
|
|
balance Decimal @default(0) @db.Decimal(65, 0)
|
|
stakedBalance Decimal @default(0) @db.Decimal(65, 0)
|
|
computingPower Decimal @default(0) @db.Decimal(65, 0)
|
|
parentId Int?
|
|
isActivated Boolean @default(false)
|
|
nickname String?
|
|
referral String @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
userId String?
|
|
childrenAccumulatedBalance Decimal @default(0) @db.Decimal(65, 0)
|
|
childrenAccumulatedCount Decimal @default(0) @db.Decimal(65, 0)
|
|
childrenAccumulatedActiveCount Decimal @default(0) @db.Decimal(65, 0)
|
|
childrenAccumulatedDeactiveCount Decimal @default(0) @db.Decimal(65, 0)
|
|
childrenAccumulatedStakedBalance Decimal @default(0) @db.Decimal(65, 0)
|
|
childrenDepth Int @default(0)
|
|
depth Int @default(0)
|
|
depositedBalance Decimal @default(0) @db.Decimal(65, 0)
|
|
realName String?
|
|
parent Node? @relation("ParentChild", fields: [parentId], references: [id])
|
|
children Node[] @relation("ParentChild")
|
|
User User? @relation(fields: [userId], references: [userId])
|
|
|
|
@@index([parentId], map: "Node_parentId_fkey")
|
|
@@index([userId], map: "Node_userId_fkey")
|
|
}
|
|
|
|
model Txes {
|
|
id Int @id @default(autoincrement())
|
|
txid String
|
|
from String
|
|
to String
|
|
value Decimal @default(0) @db.Decimal(65, 0)
|
|
fee Decimal @default(0) @db.Decimal(65, 0)
|
|
internalFee Decimal @default(0) @db.Decimal(65, 0)
|
|
type String
|
|
blockTimestamp DateTime
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
}
|
|
|
|
model User {
|
|
userId String @id @unique @default(uuid())
|
|
IMEI String?
|
|
mac String?
|
|
nickname String?
|
|
fcmToken String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
pushAllowAt DateTime?
|
|
language String?
|
|
Node Node[]
|
|
favoriteAddress favoriteAddress[]
|
|
userNotification userNotification[]
|
|
}
|
|
|
|
model favoriteAddress {
|
|
address String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
userId String
|
|
nickname String?
|
|
User User @relation(fields: [userId], references: [userId])
|
|
|
|
@@id([address, userId])
|
|
@@index([userId], map: "favoriteAddress_userId_fkey")
|
|
}
|
|
|
|
model userNotification {
|
|
id String @id @default(cuid())
|
|
title String
|
|
body String
|
|
data Json
|
|
userId String
|
|
type NotificationType
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
link String
|
|
user User @relation(fields: [userId], references: [userId])
|
|
|
|
@@index([userId], map: "userNotification_userId_fkey")
|
|
}
|
|
|
|
model userToAddressBackup {
|
|
userId String
|
|
address String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
@@id([userId, address])
|
|
@@index([userId], map: "userToAddressBackup_userId_fkey")
|
|
}
|
|
|
|
model System {
|
|
id Int @id @default(autoincrement())
|
|
key String @unique
|
|
value String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
}
|
|
|
|
model snapshot {
|
|
id Int @id
|
|
address String @unique
|
|
nickname String?
|
|
parentId Int?
|
|
stakedBalance Decimal? @db.Decimal(65, 0)
|
|
computingPower Decimal? @db.Decimal(65, 0)
|
|
childrenAccumulatedBalance Decimal? @db.Decimal(65, 0)
|
|
isActivated Boolean
|
|
balance Decimal? @db.Decimal(65, 0)
|
|
childrenAccumulatedCount Decimal? @db.Decimal(25, 4)
|
|
childrenAccumulatedDeactiveCount Decimal? @db.Decimal(65, 4)
|
|
childrenAccumulatedStakedBalance Decimal? @db.Decimal(65, 4)
|
|
Txid String?
|
|
isCPSent Boolean
|
|
isRankSent Boolean
|
|
isCPSendStarted Boolean
|
|
isRankSendStarted Boolean
|
|
}
|
|
|
|
model distribution {
|
|
id Int @id
|
|
nickname String?
|
|
address String?
|
|
parentId Int?
|
|
ranking BigInt?
|
|
stakedBalance Float?
|
|
computingPower Float?
|
|
childrenAccumulatedBalance Float?
|
|
stakedBalanceOrig Decimal? @db.Decimal(65, 0)
|
|
computingPowerOrig Decimal? @db.Decimal(65, 0)
|
|
childrenAccumulatedBalanceOrig Decimal? @db.Decimal(65, 0)
|
|
ranking_portion Decimal? @db.Decimal(25, 4)
|
|
staked_portion Decimal? @db.Decimal(65, 4)
|
|
computingPower_portion Decimal? @db.Decimal(65, 4)
|
|
childrenAccumulatedBalance_portion Decimal? @db.Decimal(65, 4)
|
|
ranking_estimated_dist Decimal? @db.Decimal(42, 16)
|
|
computingPower_estimated_dist Decimal? @db.Decimal(65, 16)
|
|
Txid String?
|
|
isCPSent Boolean
|
|
isRankSent Boolean
|
|
isCPSendStarted Boolean
|
|
isRankSendStarted Boolean
|
|
}
|
|
|
|
model LockedCoin {
|
|
id String @id @default(cuid())
|
|
address String
|
|
amount Decimal @default(0) @db.Decimal(65, 0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
unlocked Boolean @default(false)
|
|
unlockAt DateTime?
|
|
reason String?
|
|
txId String?
|
|
sendedAt DateTime?
|
|
}
|
|
|
|
model TransferHistories {
|
|
idx BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
|
txhash String @db.VarChar(100)
|
|
from_address String @db.VarChar(100)
|
|
to_address String @db.VarChar(100)
|
|
amount Decimal @db.Decimal(65, 0)
|
|
memo String? @db.Text
|
|
timestamp DateTime @default(now()) @db.DateTime
|
|
createdAt DateTime @default(now()) @db.DateTime
|
|
log_index BigInt @db.UnsignedBigInt
|
|
blockNumber BigInt @db.UnsignedBigInt
|
|
|
|
@@unique([txhash, log_index, timestamp])
|
|
@@index([idx])
|
|
@@index([log_index], name: "log_index")
|
|
@@index([from_address, to_address], name: "idxAddress")
|
|
@@map("TransferHistories")
|
|
}
|
|
|
|
enum NotificationType {
|
|
SYSTEM
|
|
USER
|
|
TRANSACTION
|
|
}
|