This repository has been archived by the owner on Jul 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
70 lines (58 loc) · 1.67 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// 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 {
provider = "postgresql"
url = env("DATABASE_URL")
}
model delegators {
address String @id @db.VarChar(36)
first_seen DateTime
alias String?
delegations delegations[]
delegations_stats delegations_stats[]
@@index([first_seen])
}
model delegations {
id BigInt @id
timestamp DateTime
amount BigInt
delegator String @db.VarChar(36)
block_hash String
block_level BigInt
// One delegators To Many delegations
delegator_item delegators? @relation(fields: [delegator], references: [address])
@@index([delegator])
@@index([block_hash])
@@index([block_level])
@@index([timestamp])
}
// WIP
enum stat_kind {
// TOP10VALIDATORS by delegated amount
TOP10VALIDATORS
// TOP100VALIDATORS by delegated amount
TOP100VALIDATORS
// DAILYVOLUME delegated to delegator
DAILYVOLUME
// WEEKLYVOLUME delegated to delegator
WEEKLYVOLUME
// MONTHLYVOLUME delegated to delegator
MONTHLYVOLUME
// YEARLYVOLUME delegated to delegator
YEARLYVOLUME
}
model delegations_stats {
id BigInt @id @default(autoincrement())
timestamp DateTime @default(now())
kind stat_kind
value Json
delegator_address String? @db.VarChar(36)
// Is delegator volume stat ? (One delegator To Many delegations_stats)
delegator delegators? @relation(fields: [delegator_address], references: [address])
@@unique([kind, timestamp])
@@index([timestamp])
@@index([kind])
}