efiber-prisma-schema 1.13.0 → 1.13.1

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.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Database schema for eFiber",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,212 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the `CableAtttributes` table. If the table is not empty, all the data it contains will be lost.
5
+
6
+ */
7
+ -- DropForeignKey
8
+ ALTER TABLE "CableAtttributes" DROP CONSTRAINT "CableAtttributes_cableId_fkey";
9
+
10
+ -- DropForeignKey
11
+ ALTER TABLE "CableAtttributes" DROP CONSTRAINT "CableAtttributes_cableTemplateId_fkey";
12
+
13
+ -- DropForeignKey
14
+ ALTER TABLE "CableAtttributes" DROP CONSTRAINT "CableAtttributes_materialId_fkey";
15
+
16
+ -- DropForeignKey
17
+ ALTER TABLE "CableAtttributes" DROP CONSTRAINT "CableAtttributes_projectId_fkey";
18
+
19
+ -- AlterTable
20
+ ALTER TABLE "Cable" ADD COLUMN "ductId" TEXT;
21
+
22
+ -- AlterTable
23
+ ALTER TABLE "Project" ADD COLUMN "conduitTemplateId" TEXT;
24
+
25
+ -- AlterTable
26
+ ALTER TABLE "qrCodeTag" ADD COLUMN "conduitId" TEXT;
27
+
28
+ -- AlterTable
29
+ ALTER TABLE "qrCodeTemplate" ADD COLUMN "conduitTemplateId" TEXT;
30
+
31
+ -- DropTable
32
+ DROP TABLE "CableAtttributes";
33
+
34
+ -- CreateTable
35
+ CREATE TABLE "Conduit" (
36
+ "id" TEXT NOT NULL,
37
+ "no" SERIAL NOT NULL,
38
+ "status" TEXT NOT NULL DEFAULT 'active',
39
+ "name" TEXT NOT NULL,
40
+ "terminalAccess" BOOLEAN NOT NULL DEFAULT false,
41
+ "photos" JSONB,
42
+ "texts" JSONB,
43
+ "files" JSONB,
44
+ "zone" JSONB,
45
+ "geometry" JSONB,
46
+ "attributes" JSONB,
47
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
48
+ "updatedAt" TIMESTAMP(3) NOT NULL,
49
+ "deletedAt" TIMESTAMP(3),
50
+ "asBuiltCoordinates" JSONB,
51
+ "isInstalled" BOOLEAN NOT NULL DEFAULT false,
52
+ "installationDate" TIMESTAMP(3),
53
+ "isInRevision" BOOLEAN NOT NULL DEFAULT false,
54
+ "installationStatus" TEXT DEFAULT 'pending',
55
+ "comments" TEXT,
56
+ "updatedById" TEXT,
57
+ "networkElementId" TEXT NOT NULL,
58
+ "nodeId" TEXT,
59
+ "installationId" TEXT,
60
+ "templateId" TEXT,
61
+ "clusterId" TEXT,
62
+
63
+ CONSTRAINT "Conduit_pkey" PRIMARY KEY ("id")
64
+ );
65
+
66
+ -- CreateTable
67
+ CREATE TABLE "Duct" (
68
+ "id" TEXT NOT NULL,
69
+ "no" SERIAL NOT NULL,
70
+ "type" TEXT NOT NULL,
71
+ "material" TEXT NOT NULL,
72
+ "dimension" DOUBLE PRECISION NOT NULL,
73
+ "typeOptions" TEXT[],
74
+ "materialOptions" TEXT[],
75
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
76
+ "updatedAt" TIMESTAMP(3) NOT NULL,
77
+ "deletedAt" TIMESTAMP(3),
78
+ "conduitId" TEXT NOT NULL,
79
+
80
+ CONSTRAINT "Duct_pkey" PRIMARY KEY ("id")
81
+ );
82
+
83
+ -- CreateTable
84
+ CREATE TABLE "ductTemplate" (
85
+ "id" TEXT NOT NULL,
86
+ "no" SERIAL NOT NULL,
87
+ "type" TEXT NOT NULL,
88
+ "material" TEXT NOT NULL,
89
+ "dimension" DOUBLE PRECISION NOT NULL,
90
+ "typeOptions" TEXT[],
91
+ "materialOptions" TEXT[],
92
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
93
+ "updatedAt" TIMESTAMP(3) NOT NULL,
94
+ "deletedAt" TIMESTAMP(3),
95
+ "conduitTemplateId" TEXT NOT NULL,
96
+
97
+ CONSTRAINT "ductTemplate_pkey" PRIMARY KEY ("id")
98
+ );
99
+
100
+ -- CreateTable
101
+ CREATE TABLE "ConduitTemplate" (
102
+ "id" TEXT NOT NULL,
103
+ "no" SERIAL NOT NULL,
104
+ "status" TEXT NOT NULL DEFAULT 'active',
105
+ "name" TEXT NOT NULL,
106
+ "terminalAccess" BOOLEAN NOT NULL DEFAULT false,
107
+ "photos" JSONB,
108
+ "texts" JSONB,
109
+ "files" JSONB,
110
+ "zone" JSONB,
111
+ "geometry" JSONB,
112
+ "attributes" JSONB,
113
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
114
+ "updatedAt" TIMESTAMP(3) NOT NULL,
115
+ "deletedAt" TIMESTAMP(3),
116
+ "updatedById" TEXT,
117
+ "networkElementId" TEXT NOT NULL,
118
+ "clusterId" TEXT,
119
+
120
+ CONSTRAINT "ConduitTemplate_pkey" PRIMARY KEY ("id")
121
+ );
122
+
123
+ -- CreateTable
124
+ CREATE TABLE "CableAttributes" (
125
+ "id" TEXT NOT NULL,
126
+ "no" SERIAL NOT NULL,
127
+ "name" TEXT NOT NULL,
128
+ "description" TEXT,
129
+ "value" TEXT,
130
+ "visibleOnMobile" BOOLEAN NOT NULL DEFAULT false,
131
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
132
+ "updatedAt" TIMESTAMP(3) NOT NULL,
133
+ "deletedAt" TIMESTAMP(3),
134
+ "cableId" TEXT,
135
+ "projectId" TEXT,
136
+ "materialId" TEXT,
137
+ "cableTemplateId" TEXT,
138
+
139
+ CONSTRAINT "CableAttributes_pkey" PRIMARY KEY ("id")
140
+ );
141
+
142
+ -- CreateIndex
143
+ CREATE UNIQUE INDEX "Conduit_id_key" ON "Conduit"("id");
144
+
145
+ -- CreateIndex
146
+ CREATE UNIQUE INDEX "Duct_id_key" ON "Duct"("id");
147
+
148
+ -- CreateIndex
149
+ CREATE UNIQUE INDEX "ductTemplate_id_key" ON "ductTemplate"("id");
150
+
151
+ -- CreateIndex
152
+ CREATE UNIQUE INDEX "ConduitTemplate_id_key" ON "ConduitTemplate"("id");
153
+
154
+ -- CreateIndex
155
+ CREATE UNIQUE INDEX "CableAttributes_id_key" ON "CableAttributes"("id");
156
+
157
+ -- AddForeignKey
158
+ ALTER TABLE "Project" ADD CONSTRAINT "Project_conduitTemplateId_fkey" FOREIGN KEY ("conduitTemplateId") REFERENCES "ConduitTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
159
+
160
+ -- AddForeignKey
161
+ ALTER TABLE "Cable" ADD CONSTRAINT "Cable_ductId_fkey" FOREIGN KEY ("ductId") REFERENCES "Duct"("id") ON DELETE SET NULL ON UPDATE CASCADE;
162
+
163
+ -- AddForeignKey
164
+ ALTER TABLE "Conduit" ADD CONSTRAINT "Conduit_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
165
+
166
+ -- AddForeignKey
167
+ ALTER TABLE "Conduit" ADD CONSTRAINT "Conduit_networkElementId_fkey" FOREIGN KEY ("networkElementId") REFERENCES "NetworkElement"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
168
+
169
+ -- AddForeignKey
170
+ ALTER TABLE "Conduit" ADD CONSTRAINT "Conduit_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES "ElementNode"("id") ON DELETE SET NULL ON UPDATE CASCADE;
171
+
172
+ -- AddForeignKey
173
+ ALTER TABLE "Conduit" ADD CONSTRAINT "Conduit_installationId_fkey" FOREIGN KEY ("installationId") REFERENCES "NetworkElementInstallation"("id") ON DELETE SET NULL ON UPDATE CASCADE;
174
+
175
+ -- AddForeignKey
176
+ ALTER TABLE "Conduit" ADD CONSTRAINT "Conduit_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "ConduitTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
177
+
178
+ -- AddForeignKey
179
+ ALTER TABLE "Conduit" ADD CONSTRAINT "Conduit_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE SET NULL ON UPDATE CASCADE;
180
+
181
+ -- AddForeignKey
182
+ ALTER TABLE "Duct" ADD CONSTRAINT "Duct_conduitId_fkey" FOREIGN KEY ("conduitId") REFERENCES "Conduit"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
183
+
184
+ -- AddForeignKey
185
+ ALTER TABLE "ductTemplate" ADD CONSTRAINT "ductTemplate_conduitTemplateId_fkey" FOREIGN KEY ("conduitTemplateId") REFERENCES "ConduitTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
186
+
187
+ -- AddForeignKey
188
+ ALTER TABLE "ConduitTemplate" ADD CONSTRAINT "ConduitTemplate_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
189
+
190
+ -- AddForeignKey
191
+ ALTER TABLE "ConduitTemplate" ADD CONSTRAINT "ConduitTemplate_networkElementId_fkey" FOREIGN KEY ("networkElementId") REFERENCES "NetworkElement"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
192
+
193
+ -- AddForeignKey
194
+ ALTER TABLE "ConduitTemplate" ADD CONSTRAINT "ConduitTemplate_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE SET NULL ON UPDATE CASCADE;
195
+
196
+ -- AddForeignKey
197
+ ALTER TABLE "CableAttributes" ADD CONSTRAINT "CableAttributes_cableId_fkey" FOREIGN KEY ("cableId") REFERENCES "Cable"("id") ON DELETE SET NULL ON UPDATE CASCADE;
198
+
199
+ -- AddForeignKey
200
+ ALTER TABLE "CableAttributes" ADD CONSTRAINT "CableAttributes_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE SET NULL ON UPDATE CASCADE;
201
+
202
+ -- AddForeignKey
203
+ ALTER TABLE "CableAttributes" ADD CONSTRAINT "CableAttributes_materialId_fkey" FOREIGN KEY ("materialId") REFERENCES "Material"("id") ON DELETE SET NULL ON UPDATE CASCADE;
204
+
205
+ -- AddForeignKey
206
+ ALTER TABLE "CableAttributes" ADD CONSTRAINT "CableAttributes_cableTemplateId_fkey" FOREIGN KEY ("cableTemplateId") REFERENCES "CableTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
207
+
208
+ -- AddForeignKey
209
+ ALTER TABLE "qrCodeTemplate" ADD CONSTRAINT "qrCodeTemplate_conduitTemplateId_fkey" FOREIGN KEY ("conduitTemplateId") REFERENCES "ConduitTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
210
+
211
+ -- AddForeignKey
212
+ ALTER TABLE "qrCodeTag" ADD CONSTRAINT "qrCodeTag_conduitId_fkey" FOREIGN KEY ("conduitId") REFERENCES "Conduit"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "Conduit" ADD COLUMN "coordinates" JSONB;
@@ -1577,6 +1577,7 @@ model Conduit {
1577
1577
  zone Json? //Color code for zone
1578
1578
  geometry Json? //Icon for the conduit
1579
1579
  attributes Json? //Attributes for the conduit
1580
+ coordinates Json?
1580
1581
 
1581
1582
  createdAt DateTime @default(now())
1582
1583
  updatedAt DateTime @updatedAt