-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.prisma
More file actions
690 lines (598 loc) · 22.5 KB
/
schema.prisma
File metadata and controls
690 lines (598 loc) · 22.5 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
generator client {
provider = "prisma-client-js"
output = "./generated/client"
previewFeatures = ["typedSql", "metrics"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model allocator {
id String @id
address String @unique
name String?
is_virtual Boolean
is_metaallocator Boolean
}
model provider {
id String @id
num_of_deals Int
total_deal_size BigInt
num_of_clients Int
last_deal_height Int
first_deal_height Int @default(0)
}
model allocator_registry {
allocator_id String
allocator_address String @unique
json_path String
registry_info Json
rejected Boolean @default(false)
@@id([allocator_id])
}
model allocator_registry_archive {
allocator_id String
allocator_address String @unique
json_path String
registry_info Json
rejected Boolean @default(false)
@@id([allocator_id])
}
model allocator_client_bookkeeping {
allocator_id String
client_id String
client_address String
json_path String
bookkeeping_info Json
@@id([allocator_id, client_id])
@@index([client_id])
}
model allocator_client_stats_daily {
date DateTime
allocator_id String
number_of_clients Int
returning_clients_percentage Decimal
average_seconds_to_first_deal Int?
@@id([allocator_id, date])
@@index([date])
}
model clients_stats_daily {
date DateTime
clients_with_active_deals Int
clients_who_have_dc_and_deals Int
total_remaining_clients_datacap BigInt
@@id(date)
}
model client_datacap_allocation {
id Int @id
client_id String
allocator_id String
timestamp DateTime
allocation Decimal @db.Decimal
@@index([client_id])
}
model client_allocator_distribution_weekly {
week DateTime
client String
allocator String
num_of_allocations Int
sum_of_allocations BigInt
@@id([week, client, allocator])
}
model cid_sharing {
client String
other_client String
total_deal_size BigInt
unique_cid_count Int
@@id([client, other_client])
}
model unified_verified_deal_hourly {
hour DateTime
client String
provider String
num_of_claims Int
num_of_ddo_claims Int @default(0)
total_deal_size BigInt
total_ddo_deal_size BigInt @default(0)
@@id([hour, client, provider])
}
model client_provider_distribution_weekly {
week DateTime
client String
provider String
total_deal_size BigInt
unique_data_size BigInt
@@id([week, client, provider])
}
model client_provider_distribution {
client String
provider String
total_deal_size BigInt
unique_data_size BigInt
claims_count BigInt?
@@id([client, provider])
@@index([provider])
}
model client_claims_hourly {
hour DateTime
client String
total_deal_size BigInt
@@id([hour, client])
}
model provider_first_client {
provider String @id
first_client String
}
model client_replica_distribution {
client String
num_of_replicas Int
total_deal_size BigInt
unique_data_size BigInt
@@id([client, num_of_replicas])
}
model providers_weekly {
week DateTime
provider String
num_of_clients Int
biggest_client_total_deal_size BigInt
total_deal_size BigInt
avg_retrievability_success_rate Float?
avg_retrievability_success_rate_http Float?
avg_retrievability_success_rate_url_finder Float?
@@id([week, provider])
}
model provider_retrievability_daily {
date DateTime
provider String
total Int
successful Int
success_rate Float
successful_http Int?
success_rate_http Float?
@@id([date, provider])
}
model provider_url_finder_retrievability_daily {
date DateTime @default(now())
provider String
success_rate Float?
@@id([date, provider])
}
model client_allocator_distribution_weekly_acc {
week DateTime
client String
allocator String
num_of_allocations Int
sum_of_allocations BigInt
@@id([week, client, allocator])
}
model client_provider_distribution_weekly_acc {
week DateTime
client String
provider String
total_deal_size BigInt
unique_data_size BigInt
@@id([week, client, provider])
}
model client_provider_distribution_weekly_acc_sync_source {
week DateTime
client String
provider String
total_deal_size BigInt
unique_data_size BigInt
@@id([week, client, provider])
}
model providers_weekly_acc {
week DateTime
provider String
num_of_clients Int
biggest_client_total_deal_size BigInt
total_deal_size BigInt
avg_retrievability_success_rate Float?
avg_retrievability_success_rate_http Float?
avg_retrievability_success_rate_url_finder Float?
@@id([week, provider])
}
model allocators_weekly_acc {
week DateTime
allocator String
num_of_clients Int
biggest_client_sum_of_allocations BigInt
total_sum_of_allocations BigInt
avg_weighted_retrievability_success_rate Float?
avg_weighted_retrievability_success_rate_http Float?
avg_weighted_retrievability_success_rate_url_finder Float?
@@id([week, allocator])
}
model client_report {
id BigInt @id @default(autoincrement())
create_date DateTime @default(now())
client String
client_address String?
avg_secs_to_first_deal Float?
organization_name String?
application_url String?
storage_provider_distribution client_report_storage_provider_distribution[]
replica_distribution client_report_replica_distribution[]
cid_sharing client_report_cid_sharing[]
check_results client_report_check_result[]
allocators String[] @default([])
allocator_required_copies String?
allocator_required_sps String?
is_public_dataset Boolean?
using_client_contract Boolean?
client_contract_max_deviation String?
storage_provider_ids_declared String[] @default([])
available_datacap BigInt?
last_datacap_spent DateTime?
last_datacap_received DateTime?
low_replica_threshold Int?
high_replica_threshold Int?
total_requested_amount BigInt?
expected_size_of_single_dataset BigInt?
total_uniq_data_set_size BigInt?
}
enum StorageProviderIpniReportingStatus {
MISREPORTING
NOT_REPORTING
OK
}
model client_report_storage_provider_distribution {
id BigInt @id @default(autoincrement())
client_report client_report @relation(fields: [client_report_id], references: [id])
client_report_id BigInt
provider String
total_deal_size BigInt
unique_data_size BigInt
location client_report_storage_provider_distribution_location?
retrievability_success_rate Float?
retrievability_success_rate_http Float?
ipni_reporting_status StorageProviderIpniReportingStatus?
ipni_reported_claims_count BigInt?
claims_count BigInt?
declared_in_application_file Boolean?
retrievability_success_rate_url_finder Float?
piece_working_url String?
consistent_retrievability Float?
inconsistent_retrievability Float?
ttfb Float?
bandwidth Float?
}
model client_report_storage_provider_distribution_location {
id BigInt @id @default(autoincrement())
ip String
city String
region String
country String
loc String
org String?
postal String?
timezone String
hostname String?
provider_distribution client_report_storage_provider_distribution @relation(fields: [provider_distribution_id], references: [id])
provider_distribution_id BigInt @unique
}
model client_report_replica_distribution {
id BigInt @id @default(autoincrement())
client_report client_report @relation(fields: [client_report_id], references: [id])
client_report_id BigInt
num_of_replicas BigInt
total_deal_size BigInt
unique_data_size BigInt
percentage Float
}
model client_report_cid_sharing {
id BigInt @id @default(autoincrement())
client_report client_report @relation(fields: [client_report_id], references: [id])
client_report_id BigInt
other_client String
other_client_application_url String?
total_deal_size BigInt
unique_cid_count Int
}
model client_report_check_result {
id String @id @default(uuid()) @db.Uuid
create_date DateTime @default(now())
result Boolean?
check ClientReportCheck
client_report client_report @relation(fields: [client_report_id], references: [id])
client_report_id BigInt
metadata Json?
@@unique([check, client_report_id])
@@index([client_report_id, create_date])
}
model allocator_report {
id String @id @default(uuid()) @db.Uuid
create_date DateTime @default(now())
allocator String
avg_secs_to_first_deal Float?
name String?
address String
clients_number Int
multisig Boolean
avg_retrievability_success_rate Float?
avg_retrievability_success_rate_http Float?
avg_retrievability_success_rate_url_finder Float?
clients allocator_report_client[]
client_allocations allocator_report_client_allocation[]
storage_provider_distribution allocator_report_storage_provider_distribution[]
data_types String[]
audit String[]
required_copies String?
required_sps String?
check_results allocator_report_check_result[]
scoring_results allocator_report_scoring_result[]
all_allocators_score_avg Float?
}
model allocator_report_client {
id String @id @default(uuid()) @db.Uuid
allocator_report allocator_report @relation(fields: [allocator_report_id], references: [id])
allocator_report_id String @db.Uuid
client_id String
name String?
allocators String[] @default([])
allocations_number Int
total_allocations BigInt
application_url String?
application_timestamp DateTime?
using_client_contract Boolean?
client_contract_max_deviation String?
replica_distribution allocator_report_client_replica_distribution[]
cid_sharing allocator_report_client_cid_sharing[]
expected_size_of_single_dataset BigInt?
total_uniq_data_set_size BigInt?
last_datacap_spent DateTime?
last_datacap_received DateTime?
}
model allocator_report_client_replica_distribution {
id BigInt @id @default(autoincrement())
num_of_replicas BigInt
total_deal_size BigInt
unique_data_size BigInt
percentage Float
allocator_report_client allocator_report_client? @relation(fields: [allocator_report_clientId], references: [id])
allocator_report_clientId String? @db.Uuid
}
model allocator_report_client_cid_sharing {
id BigInt @id @default(autoincrement())
allocator_report_client allocator_report_client? @relation(fields: [allocator_report_clientId], references: [id])
allocator_report_clientId String? @db.Uuid
other_client String
other_client_application_url String?
total_deal_size BigInt
unique_cid_count Int
}
model allocator_report_client_allocation {
id String @id @default(uuid()) @db.Uuid
allocator_report allocator_report @relation(fields: [allocator_report_id], references: [id])
allocator_report_id String @db.Uuid
client_id String
allocation BigInt
timestamp DateTime
}
model allocator_report_storage_provider_distribution {
id String @id @default(uuid()) @db.Uuid
allocator_report allocator_report @relation(fields: [allocator_report_id], references: [id])
allocator_report_id String @db.Uuid
provider String
total_deal_size BigInt
unique_data_size BigInt
perc_of_total_datacap Float
location allocator_report_storage_provider_distribution_location?
retrievability_success_rate Float?
retrievability_success_rate_http Float?
retrievability_success_rate_url_finder Float?
ipni_reporting_status StorageProviderIpniReportingStatus?
ipni_reported_claims_count BigInt?
claims_count BigInt?
consistent_retrievability Float?
inconsistent_retrievability Float?
ttfb Float?
bandwidth Float?
}
model allocator_report_storage_provider_distribution_location {
id String @id @default(uuid()) @db.Uuid
provider_distribution allocator_report_storage_provider_distribution @relation(fields: [provider_distribution_id], references: [id])
provider_distribution_id String @unique @db.Uuid
ip String
city String
region String
country String
loc String
org String?
postal String?
timezone String
hostname String?
}
model allocator_report_check_result {
id String @id @default(uuid()) @db.Uuid
create_date DateTime @default(now())
result Boolean?
check AllocatorReportCheck
check_name String?
check_description String?
allocator_report allocator_report @relation(fields: [allocator_report_id], references: [id])
allocator_report_id String @db.Uuid
metadata Json?
@@unique([check, allocator_report_id])
}
model allocator_report_scoring_result {
id String @id @default(uuid()) @db.Uuid
create_date DateTime @default(now())
score Int
metric AllocatorScoringMetric
metric_name String
metric_description String
metric_value Float
metric_average Float?
metric_unit String?
metric_value_min Float
metric_value_max Float?
allocator_report allocator_report @relation(fields: [allocator_report_id], references: [id])
allocator_report_id String @db.Uuid
metadata String[]
ranges allocator_report_scoring_result_range[]
@@unique([metric, allocator_report_id])
}
model allocator_report_scoring_result_range {
id String @id @default(uuid()) @db.Uuid
scoring_result allocator_report_scoring_result @relation(fields: [scoring_result_id], references: [id])
scoring_result_id String @db.Uuid
metric_value_min Float?
metric_value_max Float?
score Int
}
model ipni_publisher_advertisement {
id String @id
previous_id String? @unique
publisher_id String
context_id String
entries_number BigInt
is_rm Boolean
@@index([publisher_id])
}
model old_datacap_balance_nv22 {
allocator String @id
old_dc_balance BigInt
}
model old_datacap_balance_weekly {
week DateTime
allocator String
old_dc_balance BigInt
allocations BigInt
@@id([week, allocator])
}
model old_datacap_client_balance_nv22 {
client String @id
old_dc_balance BigInt
}
model old_datacap_client_balance_weekly {
week DateTime
client String
old_dc_balance BigInt
claims BigInt
@@id([week, client])
}
model ipni_reporting_daily {
date DateTime @id @default(now())
ok Int
not_reporting Int
misreporting Int
total Int
}
model provider_ip_info {
date DateTime @default(now())
provider String
lat String?
long String?
country String?
region String?
city String?
@@id([provider, date])
}
enum StorageProviderUrlFinderMetricType {
TTFB
RPA_RETRIEVABILITY
BANDWIDTH
CAR_FILES
}
enum StorageProviderUrlFinderMetricResultCodeType {
NO_PEER_ID
NO_CID_CONTACT_DATA
MISSING_ADDR_FROM_CID_CONTACT
MISSING_HTTP_ADDR_FROM_CID_CONTACT
FAILED_TO_GET_WORKING_URL
NO_DEALS_FOUND
TIMED_OUT
ERROR
SUCCESS
}
model storage_provider_url_finder_metric {
id String @id @default(uuid())
metric_type StorageProviderUrlFinderMetricType @unique
name String?
description String?
unit String?
metric_values storage_provider_url_finder_metric_value[]
}
model storage_provider_url_finder_metric_value {
id String @id @default(uuid())
provider String
metric_id String
snapshot_id String
metric storage_provider_url_finder_metric @relation(fields: [metric_id], references: [id])
storage_provider_daily_snapshot storage_provider_url_finder_daily_snapshot? @relation(fields: [snapshot_id], references: [id])
value Float?
tested_at DateTime?
@@unique([provider, metric_id, tested_at])
@@index([provider])
@@index([metric_id])
@@index([provider, metric_id, tested_at])
}
model storage_provider_url_finder_daily_snapshot {
id String @id @default(uuid())
provider String
snapshot_date DateTime
tested_at DateTime
result_code StorageProviderUrlFinderMetricResultCodeType
metric_values storage_provider_url_finder_metric_value[]
@@unique([provider, snapshot_date])
@@index([provider])
@@index([snapshot_date])
}
enum AllocatorScoringMetric {
IPNI_REPORTING
HTTP_RETRIEVABILITY
URL_FINDER_RETRIEVABILITY
CID_SHARING
DUPLICATED_DATA
UNIQUE_DATA_SET_SIZE
EQUALITY_OF_DATACAP_DISTRIBUTION
CLIENT_DIVERSITY
CLIENT_PREVIOUS_APPLICATIONS
}
enum ClientReportCheck {
STORAGE_PROVIDER_DISTRIBUTION_ALL_LOCATED_IN_THE_SAME_REGION
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_EXCEED_PROVIDER_DEAL
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_EXCEED_MAX_DUPLICATION
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_UNKNOWN_LOCATION
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_RETRIEVABILITY_ZERO
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_RETRIEVABILITY_75
STORAGE_PROVIDER_URL_FINDER_RETRIEVABILITY_ZERO
STORAGE_PROVIDER_URL_FINDER_RETRIEVABILITY_75
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_IPNI_MISREPORTING
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_IPNI_NOT_REPORTING
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_DECLARED_NOT_USED
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_NOT_DECLARED
DEAL_DATA_REPLICATION_LOW_REPLICA
DEAL_DATA_REPLICATION_HIGH_REPLICA
DEAL_DATA_REPLICATION_CID_SHARING
MULTIPLE_ALLOCATORS
NOT_ENOUGH_COPIES
INACTIVITY
UNIQ_DATA_SET_SIZE_TO_DECLARED
}
enum AllocatorReportCheck {
CLIENT_MULTIPLE_ALLOCATORS
CLIENT_NOT_ENOUGH_COPIES
MANUAL_ALLOCATION_SCHEDULE
// client reports checks
STORAGE_PROVIDER_DISTRIBUTION_ALL_LOCATED_IN_THE_SAME_REGION
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_EXCEED_PROVIDER_DEAL
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_EXCEED_MAX_DUPLICATION
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_UNKNOWN_LOCATION
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_RETRIEVABILITY_ZERO
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_RETRIEVABILITY_75
STORAGE_PROVIDER_URL_FINDER_RETRIEVABILITY_ZERO
STORAGE_PROVIDER_URL_FINDER_RETRIEVABILITY_75
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_IPNI_MISREPORTING
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_IPNI_NOT_REPORTING
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_DECLARED_NOT_USED
STORAGE_PROVIDER_DISTRIBUTION_PROVIDERS_NOT_DECLARED
DEAL_DATA_REPLICATION_LOW_REPLICA
DEAL_DATA_REPLICATION_HIGH_REPLICA
DEAL_DATA_REPLICATION_CID_SHARING
MULTIPLE_ALLOCATORS
NOT_ENOUGH_COPIES
INACTIVITY
UNIQ_DATA_SET_SIZE_TO_DECLARED
}