efiber-prisma-schema 1.11.2 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "ProjectLevel" AS ENUM ('Subsidiary', 'Client', 'MainProject', 'Project', 'CentralOffice', 'Cluster');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "AggregationOperation" AS ENUM ('LIST', 'SUM', 'COUNT', 'AVERAGE');
|
|
6
|
+
|
|
7
|
+
-- CreateEnum
|
|
8
|
+
CREATE TYPE "ArithmeticOperation" AS ENUM ('ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE');
|
|
9
|
+
|
|
10
|
+
-- CreateEnum
|
|
11
|
+
CREATE TYPE "ReportUsage" AS ENUM ('TABLE', 'VISUALIZATION');
|
|
12
|
+
|
|
13
|
+
-- CreateEnum
|
|
14
|
+
CREATE TYPE "ValueFormat" AS ENUM ('PERCENTAGE', 'NUMBER');
|
|
15
|
+
|
|
16
|
+
-- CreateEnum
|
|
17
|
+
CREATE TYPE "ChartType" AS ENUM ('BAR', 'LINE', 'PIE');
|
|
18
|
+
|
|
19
|
+
-- AlterTable
|
|
20
|
+
ALTER TABLE "Building" ADD COLUMN "flatsPerFloor" INTEGER,
|
|
21
|
+
ADD COLUMN "floorCount" INTEGER,
|
|
22
|
+
ADD COLUMN "totalFlats" INTEGER;
|
|
23
|
+
|
|
24
|
+
-- AlterTable
|
|
25
|
+
ALTER TABLE "Cable" ADD COLUMN "cableLength" DOUBLE PRECISION;
|
|
26
|
+
|
|
27
|
+
-- AlterTable
|
|
28
|
+
ALTER TABLE "FDTSRO" ADD COLUMN "fdtsroMaxCapacity" INTEGER;
|
|
29
|
+
|
|
30
|
+
-- AlterTable
|
|
31
|
+
ALTER TABLE "PboFat" ADD COLUMN "fatAvailableCapacity" INTEGER,
|
|
32
|
+
ADD COLUMN "fatExistingSubscribers" INTEGER,
|
|
33
|
+
ADD COLUMN "fatMaxCapacity" INTEGER;
|
|
34
|
+
|
|
35
|
+
-- AlterTable
|
|
36
|
+
ALTER TABLE "SpliceClosure" ADD COLUMN "spliceClosureMaxCapacity" INTEGER;
|
|
37
|
+
|
|
38
|
+
-- AlterTable
|
|
39
|
+
ALTER TABLE "ZoneNro" ADD COLUMN "zoneHouseCount" INTEGER;
|
|
40
|
+
|
|
41
|
+
-- CreateTable
|
|
42
|
+
CREATE TABLE "IntegrationReportTemplate" (
|
|
43
|
+
"id" TEXT NOT NULL,
|
|
44
|
+
"no" SERIAL NOT NULL,
|
|
45
|
+
"name" TEXT NOT NULL,
|
|
46
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
47
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
48
|
+
"deletedAt" TIMESTAMP(3),
|
|
49
|
+
"createdById" TEXT,
|
|
50
|
+
|
|
51
|
+
CONSTRAINT "IntegrationReportTemplate_pkey" PRIMARY KEY ("id")
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
-- CreateTable
|
|
55
|
+
CREATE TABLE "ReportMetric" (
|
|
56
|
+
"id" TEXT NOT NULL,
|
|
57
|
+
"reportTemplateId" TEXT NOT NULL,
|
|
58
|
+
"elementType" "NetworkElementChildType" NOT NULL,
|
|
59
|
+
"attributeName" TEXT NOT NULL,
|
|
60
|
+
"formula" "AggregationOperation" NOT NULL,
|
|
61
|
+
"groupByLevel" "ProjectLevel" NOT NULL,
|
|
62
|
+
"usage" "ReportUsage"[] DEFAULT ARRAY['TABLE']::"ReportUsage"[],
|
|
63
|
+
|
|
64
|
+
CONSTRAINT "ReportMetric_pkey" PRIMARY KEY ("id")
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
-- CreateTable
|
|
68
|
+
CREATE TABLE "ReportFormulaConfig" (
|
|
69
|
+
"metricId" TEXT NOT NULL,
|
|
70
|
+
"resultName" TEXT NOT NULL,
|
|
71
|
+
"numberOfVariables" INTEGER NOT NULL,
|
|
72
|
+
"variableAttributes" JSONB NOT NULL,
|
|
73
|
+
"operations" "ArithmeticOperation"[],
|
|
74
|
+
"resultFormat" "ValueFormat" NOT NULL DEFAULT 'NUMBER',
|
|
75
|
+
|
|
76
|
+
CONSTRAINT "ReportFormulaConfig_pkey" PRIMARY KEY ("metricId")
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
-- CreateTable
|
|
80
|
+
CREATE TABLE "ReportVisualization" (
|
|
81
|
+
"id" TEXT NOT NULL,
|
|
82
|
+
"templateId" TEXT NOT NULL,
|
|
83
|
+
"metricId" TEXT NOT NULL,
|
|
84
|
+
"chartType" "ChartType" NOT NULL,
|
|
85
|
+
"xAxisField" TEXT,
|
|
86
|
+
"yAxisField" TEXT,
|
|
87
|
+
"useCustomColors" BOOLEAN NOT NULL DEFAULT false,
|
|
88
|
+
"customColors" JSONB,
|
|
89
|
+
|
|
90
|
+
CONSTRAINT "ReportVisualization_pkey" PRIMARY KEY ("id")
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
-- CreateTable
|
|
94
|
+
CREATE TABLE "ReportTable" (
|
|
95
|
+
"id" TEXT NOT NULL,
|
|
96
|
+
"templateId" TEXT NOT NULL,
|
|
97
|
+
"metricId" TEXT NOT NULL,
|
|
98
|
+
"columns" TEXT[],
|
|
99
|
+
"includeHeader" BOOLEAN NOT NULL DEFAULT true,
|
|
100
|
+
"sortBy" JSONB,
|
|
101
|
+
|
|
102
|
+
CONSTRAINT "ReportTable_pkey" PRIMARY KEY ("id")
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
-- CreateIndex
|
|
106
|
+
CREATE UNIQUE INDEX "IntegrationReportTemplate_id_key" ON "IntegrationReportTemplate"("id");
|
|
107
|
+
|
|
108
|
+
-- CreateIndex
|
|
109
|
+
CREATE UNIQUE INDEX "ReportMetric_id_key" ON "ReportMetric"("id");
|
|
110
|
+
|
|
111
|
+
-- CreateIndex
|
|
112
|
+
CREATE UNIQUE INDEX "ReportVisualization_id_key" ON "ReportVisualization"("id");
|
|
113
|
+
|
|
114
|
+
-- CreateIndex
|
|
115
|
+
CREATE UNIQUE INDEX "ReportTable_id_key" ON "ReportTable"("id");
|
|
116
|
+
|
|
117
|
+
-- AddForeignKey
|
|
118
|
+
ALTER TABLE "IntegrationReportTemplate" ADD CONSTRAINT "IntegrationReportTemplate_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
119
|
+
|
|
120
|
+
-- AddForeignKey
|
|
121
|
+
ALTER TABLE "ReportMetric" ADD CONSTRAINT "ReportMetric_reportTemplateId_fkey" FOREIGN KEY ("reportTemplateId") REFERENCES "IntegrationReportTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
122
|
+
|
|
123
|
+
-- AddForeignKey
|
|
124
|
+
ALTER TABLE "ReportFormulaConfig" ADD CONSTRAINT "ReportFormulaConfig_metricId_fkey" FOREIGN KEY ("metricId") REFERENCES "ReportMetric"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
125
|
+
|
|
126
|
+
-- AddForeignKey
|
|
127
|
+
ALTER TABLE "ReportVisualization" ADD CONSTRAINT "ReportVisualization_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "IntegrationReportTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
128
|
+
|
|
129
|
+
-- AddForeignKey
|
|
130
|
+
ALTER TABLE "ReportVisualization" ADD CONSTRAINT "ReportVisualization_metricId_fkey" FOREIGN KEY ("metricId") REFERENCES "ReportMetric"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
131
|
+
|
|
132
|
+
-- AddForeignKey
|
|
133
|
+
ALTER TABLE "ReportTable" ADD CONSTRAINT "ReportTable_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "IntegrationReportTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
134
|
+
|
|
135
|
+
-- AddForeignKey
|
|
136
|
+
ALTER TABLE "ReportTable" ADD CONSTRAINT "ReportTable_metricId_fkey" FOREIGN KEY ("metricId") REFERENCES "ReportMetric"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -42,7 +42,7 @@ enum AggregationOperation {
|
|
|
42
42
|
AVERAGE
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
enum
|
|
45
|
+
enum ArithmeticOperation {
|
|
46
46
|
ADD
|
|
47
47
|
SUBTRACT
|
|
48
48
|
MULTIPLY
|
|
@@ -2432,32 +2432,32 @@ model ReportMetric {
|
|
|
2432
2432
|
reportTemplate IntegrationReportTemplate @relation(fields: [reportTemplateId], references: [id])
|
|
2433
2433
|
reportTemplateId String
|
|
2434
2434
|
|
|
2435
|
-
elementType
|
|
2436
|
-
attributeName
|
|
2435
|
+
elementType NetworkElementChildType?
|
|
2436
|
+
attributeName String //Name of the attribute to be reported
|
|
2437
2437
|
|
|
2438
2438
|
// Aggregation across records
|
|
2439
|
-
formula
|
|
2440
|
-
groupByLevel
|
|
2441
|
-
|
|
2439
|
+
formula AggregationOperation?
|
|
2440
|
+
groupByLevel ProjectLevel?
|
|
2441
|
+
|
|
2442
2442
|
// Formula configuration
|
|
2443
2443
|
formulaConfig ReportFormulaConfig?
|
|
2444
2444
|
|
|
2445
2445
|
// Usage Classification
|
|
2446
|
-
usage
|
|
2446
|
+
usage ReportUsage[] @default([TABLE])
|
|
2447
2447
|
|
|
2448
2448
|
visualizations ReportVisualization[]
|
|
2449
2449
|
ReportTable ReportTable[]
|
|
2450
2450
|
}
|
|
2451
2451
|
|
|
2452
2452
|
model ReportFormulaConfig {
|
|
2453
|
-
metricId
|
|
2454
|
-
metric
|
|
2453
|
+
metricId String @id
|
|
2454
|
+
metric ReportMetric @relation(fields: [metricId], references: [id])
|
|
2455
2455
|
|
|
2456
|
-
resultName
|
|
2457
|
-
numberOfVariables
|
|
2456
|
+
resultName String //Name of the result to be reported
|
|
2457
|
+
numberOfVariables Int //Number of variables in the formula
|
|
2458
2458
|
variableAttributes Json //e.g {"variable1": "Client Name", "variable2": "Fat Available Capacity"}
|
|
2459
|
-
operations
|
|
2460
|
-
resultFormat ValueFormat
|
|
2459
|
+
operations ArithmeticOperation[] //e.g {"operation1": "sum", "operation2": "average"}
|
|
2460
|
+
resultFormat ValueFormat @default(NUMBER)
|
|
2461
2461
|
}
|
|
2462
2462
|
|
|
2463
2463
|
model ReportVisualization {
|