efiber-prisma-schema 1.12.6 → 1.12.7

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.6",
3
+ "version": "1.12.7",
4
4
  "description": "Database schema for eFiber",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,44 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "CentralOfficeTeamPosition" AS ENUM ('Supervisor', 'Designer', 'Technician');
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "CentralOfficeTeam" (
6
+ "id" TEXT NOT NULL,
7
+ "no" SERIAL NOT NULL,
8
+ "name" TEXT NOT NULL,
9
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
10
+ "updatedAt" TIMESTAMP(3) NOT NULL,
11
+ "deletedAt" TIMESTAMP(3),
12
+ "centralOfficeId" TEXT,
13
+
14
+ CONSTRAINT "CentralOfficeTeam_pkey" PRIMARY KEY ("id")
15
+ );
16
+
17
+ -- CreateTable
18
+ CREATE TABLE "CentralOfficeUser" (
19
+ "id" TEXT NOT NULL,
20
+ "no" SERIAL NOT NULL,
21
+ "role" "CentralOfficeTeamPosition" NOT NULL DEFAULT 'Technician',
22
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
23
+ "updatedAt" TIMESTAMP(3) NOT NULL,
24
+ "deletedAt" TIMESTAMP(3),
25
+ "centralOfficeTeamId" TEXT,
26
+ "userId" TEXT NOT NULL,
27
+
28
+ CONSTRAINT "CentralOfficeUser_pkey" PRIMARY KEY ("id")
29
+ );
30
+
31
+ -- CreateIndex
32
+ CREATE UNIQUE INDEX "CentralOfficeTeam_id_key" ON "CentralOfficeTeam"("id");
33
+
34
+ -- CreateIndex
35
+ CREATE UNIQUE INDEX "CentralOfficeUser_id_key" ON "CentralOfficeUser"("id");
36
+
37
+ -- AddForeignKey
38
+ ALTER TABLE "CentralOfficeTeam" ADD CONSTRAINT "CentralOfficeTeam_centralOfficeId_fkey" FOREIGN KEY ("centralOfficeId") REFERENCES "CentralOffice"("id") ON DELETE SET NULL ON UPDATE CASCADE;
39
+
40
+ -- AddForeignKey
41
+ ALTER TABLE "CentralOfficeUser" ADD CONSTRAINT "CentralOfficeUser_centralOfficeTeamId_fkey" FOREIGN KEY ("centralOfficeTeamId") REFERENCES "CentralOfficeTeam"("id") ON DELETE SET NULL ON UPDATE CASCADE;
42
+
43
+ -- AddForeignKey
44
+ ALTER TABLE "CentralOfficeUser" ADD CONSTRAINT "CentralOfficeUser_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -84,6 +84,12 @@ enum MapElementType {
84
84
  Polygon
85
85
  }
86
86
 
87
+ enum CentralOfficeTeamPosition {
88
+ Supervisor
89
+ Designer
90
+ Technician
91
+ }
92
+
87
93
  model Country {
88
94
  id String @id @unique @default(uuid())
89
95
  no Int @default(autoincrement())
@@ -470,6 +476,7 @@ model User {
470
476
  IntegrationReportTemplate IntegrationReportTemplate[]
471
477
  MapElementTemplate MapElementTemplate[]
472
478
  MapElement MapElement[]
479
+ CentralOfficeUser CentralOfficeUser[]
473
480
  }
474
481
 
475
482
  model MainProject {
@@ -2265,7 +2272,6 @@ model MapElementTemplate {
2265
2272
 
2266
2273
  networkElement NetworkElement @relation(fields: [networkElementId], references: [id])
2267
2274
  networkElementId String
2268
-
2269
2275
 
2270
2276
  projects Project[]
2271
2277
 
@@ -2353,8 +2359,9 @@ model CentralOffice {
2353
2359
  project Project? @relation(fields: [projectId], references: [id])
2354
2360
  projectId String?
2355
2361
 
2356
- users User[]
2357
- Cluster Cluster[]
2362
+ users User[]
2363
+ Cluster Cluster[]
2364
+ CentralOfficeTeam CentralOfficeTeam[]
2358
2365
  }
2359
2366
 
2360
2367
  model Cluster {
@@ -2402,6 +2409,36 @@ model Cluster {
2402
2409
  MapElement MapElement[]
2403
2410
  }
2404
2411
 
2412
+ model CentralOfficeTeam {
2413
+ id String @id @unique @default(uuid())
2414
+ no Int @default(autoincrement())
2415
+ name String
2416
+
2417
+ createdAt DateTime @default(now())
2418
+ updatedAt DateTime @updatedAt
2419
+ deletedAt DateTime?
2420
+
2421
+ centralOffice CentralOffice? @relation(fields: [centralOfficeId], references: [id])
2422
+ centralOfficeId String?
2423
+ users CentralOfficeUser[]
2424
+ }
2425
+
2426
+ model CentralOfficeUser {
2427
+ id String @id @unique @default(uuid())
2428
+ no Int @default(autoincrement())
2429
+ role CentralOfficeTeamPosition @default(Technician)
2430
+
2431
+ createdAt DateTime @default(now())
2432
+ updatedAt DateTime @updatedAt
2433
+ deletedAt DateTime?
2434
+
2435
+ centralOfficeTeam CentralOfficeTeam? @relation(fields: [centralOfficeTeamId], references: [id])
2436
+ centralOfficeTeamId String?
2437
+
2438
+ user User @relation(fields: [userId], references: [id])
2439
+ userId String
2440
+ }
2441
+
2405
2442
  model qrCodeTemplate {
2406
2443
  id String @id @unique @default(uuid())
2407
2444
  no Int @default(autoincrement())