efiber-prisma-schema 1.12.3 → 1.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efiber-prisma-schema",
3
- "version": "1.12.3",
3
+ "version": "1.12.4",
4
4
  "description": "Database schema for eFiber",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,95 @@
1
+ -- AlterTable
2
+ ALTER TABLE "Project" ADD COLUMN "mapElementTemplateId" TEXT;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "qrCodeTag" ADD COLUMN "mapElementId" TEXT;
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "qrCodeTemplate" ADD COLUMN "mapElementTemplateId" TEXT;
9
+
10
+ -- CreateTable
11
+ CREATE TABLE "MapElementTemplate" (
12
+ "id" TEXT NOT NULL,
13
+ "no" SERIAL NOT NULL,
14
+ "status" TEXT NOT NULL DEFAULT 'active',
15
+ "name" TEXT,
16
+ "photos" JSONB,
17
+ "texts" JSONB,
18
+ "files" JSONB,
19
+ "zone" JSONB,
20
+ "geometry" JSONB,
21
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
22
+ "updatedAt" TIMESTAMP(3) NOT NULL,
23
+ "deletedAt" TIMESTAMP(3),
24
+ "updatedById" TEXT,
25
+ "networkElementId" TEXT NOT NULL,
26
+ "clusterId" TEXT,
27
+
28
+ CONSTRAINT "MapElementTemplate_pkey" PRIMARY KEY ("id")
29
+ );
30
+
31
+ -- CreateTable
32
+ CREATE TABLE "MapElement" (
33
+ "id" TEXT NOT NULL,
34
+ "no" SERIAL NOT NULL,
35
+ "status" TEXT NOT NULL DEFAULT 'active',
36
+ "name" TEXT,
37
+ "photos" JSONB,
38
+ "texts" JSONB,
39
+ "files" JSONB,
40
+ "zone" JSONB,
41
+ "geometry" JSONB,
42
+ "coordinates" JSONB,
43
+ "autoincrement" BOOLEAN NOT NULL DEFAULT true,
44
+ "namePrefix" TEXT,
45
+ "templateIndex" INTEGER,
46
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
47
+ "updatedAt" TIMESTAMP(3) NOT NULL,
48
+ "deletedAt" TIMESTAMP(3),
49
+ "updatedById" TEXT,
50
+ "networkElementId" TEXT NOT NULL,
51
+ "templateId" TEXT,
52
+ "projectId" TEXT,
53
+ "clusterId" TEXT,
54
+
55
+ CONSTRAINT "MapElement_pkey" PRIMARY KEY ("id")
56
+ );
57
+
58
+ -- CreateIndex
59
+ CREATE UNIQUE INDEX "MapElementTemplate_id_key" ON "MapElementTemplate"("id");
60
+
61
+ -- CreateIndex
62
+ CREATE UNIQUE INDEX "MapElement_id_key" ON "MapElement"("id");
63
+
64
+ -- AddForeignKey
65
+ ALTER TABLE "Project" ADD CONSTRAINT "Project_mapElementTemplateId_fkey" FOREIGN KEY ("mapElementTemplateId") REFERENCES "MapElementTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
66
+
67
+ -- AddForeignKey
68
+ ALTER TABLE "MapElementTemplate" ADD CONSTRAINT "MapElementTemplate_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
69
+
70
+ -- AddForeignKey
71
+ ALTER TABLE "MapElementTemplate" ADD CONSTRAINT "MapElementTemplate_networkElementId_fkey" FOREIGN KEY ("networkElementId") REFERENCES "NetworkElement"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
72
+
73
+ -- AddForeignKey
74
+ ALTER TABLE "MapElementTemplate" ADD CONSTRAINT "MapElementTemplate_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE SET NULL ON UPDATE CASCADE;
75
+
76
+ -- AddForeignKey
77
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
78
+
79
+ -- AddForeignKey
80
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_networkElementId_fkey" FOREIGN KEY ("networkElementId") REFERENCES "NetworkElement"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
81
+
82
+ -- AddForeignKey
83
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "MapElementTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
84
+
85
+ -- AddForeignKey
86
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE SET NULL ON UPDATE CASCADE;
87
+
88
+ -- AddForeignKey
89
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE SET NULL ON UPDATE CASCADE;
90
+
91
+ -- AddForeignKey
92
+ ALTER TABLE "qrCodeTemplate" ADD CONSTRAINT "qrCodeTemplate_mapElementTemplateId_fkey" FOREIGN KEY ("mapElementTemplateId") REFERENCES "MapElementTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
93
+
94
+ -- AddForeignKey
95
+ ALTER TABLE "qrCodeTag" ADD CONSTRAINT "qrCodeTag_mapElementId_fkey" FOREIGN KEY ("mapElementId") REFERENCES "MapElement"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "MapElementType" AS ENUM ('Marker', 'Polyline', 'Polygon');
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "MapElement" ADD COLUMN "mapElementType" "MapElementType" NOT NULL DEFAULT 'Marker';
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "MapElementTemplate" ADD COLUMN "mapElementType" "MapElementType" NOT NULL DEFAULT 'Marker';
@@ -78,6 +78,12 @@ enum MetricType {
78
78
  FormulaResult
79
79
  }
80
80
 
81
+ enum MapElementType {
82
+ Marker
83
+ Polyline
84
+ Polygon
85
+ }
86
+
81
87
  model Country {
82
88
  id String @id @unique @default(uuid())
83
89
  no Int @default(autoincrement())
@@ -2233,6 +2239,8 @@ model MapElementTemplate {
2233
2239
  zone Json? //Color code for zone
2234
2240
  geometry Json? //Icon for the map element
2235
2241
 
2242
+ mapElementType MapElementType @default(Marker)
2243
+
2236
2244
  createdAt DateTime @default(now())
2237
2245
  updatedAt DateTime @updatedAt
2238
2246
  deletedAt DateTime?
@@ -2242,6 +2250,7 @@ model MapElementTemplate {
2242
2250
 
2243
2251
  networkElement NetworkElement @relation(fields: [networkElementId], references: [id])
2244
2252
  networkElementId String
2253
+
2245
2254
 
2246
2255
  projects Project[]
2247
2256
 
@@ -2267,6 +2276,8 @@ model MapElement {
2267
2276
  namePrefix String?
2268
2277
  templateIndex Int?
2269
2278
 
2279
+ mapElementType MapElementType @default(Marker)
2280
+
2270
2281
  createdAt DateTime @default(now())
2271
2282
  updatedAt DateTime @updatedAt
2272
2283
  deletedAt DateTime?