efiber-prisma-schema 1.13.1 → 1.13.3

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.1",
3
+ "version": "1.13.3",
4
4
  "description": "Database schema for eFiber",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,79 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "CableAttachmentRole" AS ENUM ('DESTINATION', 'ORIGIN');
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "Cable" ADD COLUMN "brand" TEXT,
6
+ ADD COLUMN "brandDescription" TEXT,
7
+ ADD COLUMN "capacity" TEXT,
8
+ ADD COLUMN "centralOffice" TEXT,
9
+ ADD COLUMN "client" TEXT,
10
+ ADD COLUMN "enclosureDestinationId" TEXT,
11
+ ADD COLUMN "enclosureDestinationType" TEXT,
12
+ ADD COLUMN "enclosureOriginId" TEXT,
13
+ ADD COLUMN "enclosureOriginType" TEXT,
14
+ ADD COLUMN "fibersActive" INTEGER,
15
+ ADD COLUMN "fibersDark" INTEGER,
16
+ ADD COLUMN "fibersDedicated" INTEGER,
17
+ ADD COLUMN "fibersReserved" INTEGER,
18
+ ADD COLUMN "mainProject" TEXT,
19
+ ADD COLUMN "pboFatId" TEXT,
20
+ ADD COLUMN "projectPhase" TEXT,
21
+ ADD COLUMN "subsidiary" TEXT,
22
+ ADD COLUMN "type" TEXT;
23
+
24
+ -- AlterTable
25
+ ALTER TABLE "PboFat" ADD COLUMN "address" TEXT,
26
+ ADD COLUMN "brand" TEXT,
27
+ ADD COLUMN "brandDescription" TEXT,
28
+ ADD COLUMN "centralOffice" TEXT,
29
+ ADD COLUMN "client" TEXT,
30
+ ADD COLUMN "mainProject" TEXT,
31
+ ADD COLUMN "materialListReference" TEXT,
32
+ ADD COLUMN "nextEquipmentId" TEXT,
33
+ ADD COLUMN "nextEquipmentType" TEXT,
34
+ ADD COLUMN "placeOfInstallation" TEXT,
35
+ ADD COLUMN "previousEquipmentId" TEXT,
36
+ ADD COLUMN "previousEquipmentType" TEXT,
37
+ ADD COLUMN "projectPhase" TEXT,
38
+ ADD COLUMN "splitter1" TEXT,
39
+ ADD COLUMN "splitter2" TEXT,
40
+ ADD COLUMN "subsidiary" TEXT;
41
+
42
+ -- CreateTable
43
+ CREATE TABLE "CableAttachment" (
44
+ "id" TEXT NOT NULL,
45
+ "no" SERIAL NOT NULL,
46
+ "cableId" TEXT NOT NULL,
47
+ "targetType" TEXT NOT NULL,
48
+ "targetId" TEXT NOT NULL,
49
+ "role" "CableAttachmentRole" NOT NULL,
50
+ "metadata" JSONB,
51
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
52
+ "updatedAt" TIMESTAMP(3) NOT NULL,
53
+
54
+ CONSTRAINT "CableAttachment_pkey" PRIMARY KEY ("id")
55
+ );
56
+
57
+ -- CreateIndex
58
+ CREATE UNIQUE INDEX "CableAttachment_id_key" ON "CableAttachment"("id");
59
+
60
+ -- CreateIndex
61
+ CREATE INDEX "CableAttachment_targetType_targetId_idx" ON "CableAttachment"("targetType", "targetId");
62
+
63
+ -- CreateIndex
64
+ CREATE INDEX "CableAttachment_cableId_role_idx" ON "CableAttachment"("cableId", "role");
65
+
66
+ -- CreateIndex
67
+ CREATE UNIQUE INDEX "CableAttachment_cableId_targetType_targetId_role_key" ON "CableAttachment"("cableId", "targetType", "targetId", "role");
68
+
69
+ -- CreateIndex
70
+ CREATE INDEX "Cable_enclosureOriginType_enclosureOriginId_idx" ON "Cable"("enclosureOriginType", "enclosureOriginId");
71
+
72
+ -- CreateIndex
73
+ CREATE INDEX "Cable_enclosureDestinationType_enclosureDestinationId_idx" ON "Cable"("enclosureDestinationType", "enclosureDestinationId");
74
+
75
+ -- AddForeignKey
76
+ ALTER TABLE "Cable" ADD CONSTRAINT "Cable_pboFatId_fkey" FOREIGN KEY ("pboFatId") REFERENCES "PboFat"("id") ON DELETE SET NULL ON UPDATE CASCADE;
77
+
78
+ -- AddForeignKey
79
+ ALTER TABLE "CableAttachment" ADD CONSTRAINT "CableAttachment_cableId_fkey" FOREIGN KEY ("cableId") REFERENCES "Cable"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -0,0 +1,9 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `fatMaxCapacity` on the `PboFat` table. All the data in the column will be lost.
5
+
6
+ */
7
+ -- AlterTable
8
+ ALTER TABLE "PboFat" DROP COLUMN "fatMaxCapacity",
9
+ ADD COLUMN "fatMaximumCapacity" INTEGER;
@@ -127,6 +127,11 @@ enum AttributeType {
127
127
  JSON
128
128
  }
129
129
 
130
+ enum CableAttachmentRole {
131
+ DESTINATION
132
+ ORIGIN
133
+ }
134
+
130
135
  model Country {
131
136
  id String @id @unique @default(uuid())
132
137
  no Int @default(autoincrement())
@@ -1493,8 +1498,25 @@ model Cable {
1493
1498
  comments String?
1494
1499
 
1495
1500
  // Reporting mirrors
1496
- cableLength Float? //Length of the cable in meters
1497
- actualCableLength Float? //Actual length of the cable in meters
1501
+ enclosureOriginType String? //Type of the origin enclosure
1502
+ enclosureOriginId String? //ID of the origin enclosure
1503
+ enclosureDestinationType String? //Type of the destination enclosure
1504
+ enclosureDestinationId String? //ID of the destination enclosure
1505
+ cableLength Float? //Length of the cable in meters
1506
+ actualCableLength Float? //Actual length of the cable in meters
1507
+ type String? //Type of cable (e.g., aerial, underground)
1508
+ capacity String? //Capacity of cable(12FO, 24FO, 48FO)
1509
+ fibersActive Int? //Number of active fibers
1510
+ fibersReserved Int? //Number of reserved fibers
1511
+ fibersDark Int? //Number of dark fibers
1512
+ fibersDedicated Int? //Number of dedicated fibers
1513
+ brand String? //Brand of the cable
1514
+ brandDescription String? //Description of the brand
1515
+ centralOffice String? //Central office associated with the cable
1516
+ mainProject String? //Main project associated with the cable
1517
+ projectPhase String? //Project phase (e.g., planning, execution)
1518
+ client String? //Client associated with the cable
1519
+ subsidiary String? //Subsidiary or branch
1498
1520
 
1499
1521
  createdAt DateTime @default(now())
1500
1522
  updatedAt DateTime @updatedAt
@@ -1518,6 +1540,7 @@ model Cable {
1518
1540
  installation NetworkElementInstallation? @relation(fields: [installationId], references: [id])
1519
1541
  installationId String?
1520
1542
 
1543
+ cableAttachments CableAttachment[]
1521
1544
  cableAttributes CableAttributes[]
1522
1545
  PboFatAttributes PboFatAttributes[]
1523
1546
  qrCodeTag qrCodeTag[]
@@ -1526,6 +1549,33 @@ model Cable {
1526
1549
  Revision Revision[]
1527
1550
  Duct Duct? @relation(fields: [ductId], references: [id])
1528
1551
  ductId String?
1552
+ PboFat PboFat? @relation(fields: [pboFatId], references: [id])
1553
+ pboFatId String?
1554
+
1555
+
1556
+ @@index([enclosureOriginType, enclosureOriginId])
1557
+ @@index([enclosureDestinationType, enclosureDestinationId])
1558
+ }
1559
+
1560
+ model CableAttachment {
1561
+ id String @id @unique @default(uuid())
1562
+ no Int @default(autoincrement())
1563
+
1564
+ cable Cable @relation(fields: [cableId], references: [id])
1565
+ cableId String
1566
+
1567
+ targetType String
1568
+ targetId String
1569
+
1570
+ role CableAttachmentRole
1571
+ metadata Json?
1572
+
1573
+ createdAt DateTime @default(now())
1574
+ updatedAt DateTime @updatedAt
1575
+
1576
+ @@unique([cableId, targetType, targetId, role])
1577
+ @@index([targetType, targetId])
1578
+ @@index([cableId, role])
1529
1579
  }
1530
1580
 
1531
1581
  model CableTemplate {
@@ -1560,7 +1610,7 @@ model CableTemplate {
1560
1610
  cableAttributes CableAttributes[]
1561
1611
  qrCodeTemplate qrCodeTemplate[]
1562
1612
  Cable Cable[]
1563
- cluster Cluster? @relation(fields: [clusterId], references: [id])
1613
+ cluster Cluster? @relation(fields: [clusterId], references: [id])
1564
1614
  clusterId String?
1565
1615
  }
1566
1616
 
@@ -1682,7 +1732,7 @@ model ConduitTemplate {
1682
1732
  cluster Cluster? @relation(fields: [clusterId], references: [id])
1683
1733
  clusterId String?
1684
1734
  qrCodeTemplate qrCodeTemplate[]
1685
- ductTemplates ductTemplate[]
1735
+ ductTemplates ductTemplate[]
1686
1736
  }
1687
1737
 
1688
1738
  model CableAttributes {
@@ -1786,9 +1836,20 @@ model PboFat {
1786
1836
  installationStatus String? @default("pending") //pending, approved, in-revision
1787
1837
 
1788
1838
  // Reporting mirrors
1789
- fatMaxCapacity Int? //Maximum capacity of the PBO FAT
1839
+ fatMaximumCapacity Int? //Maximum capacity of the PBO FAT
1790
1840
  fatExistingSubscribers Int? //Existing subscribers in the PBO FAT
1791
1841
  fatAvailableCapacity Int? //Available capacity in the PBO FAT
1842
+ placeOfInstallation String? //ID to an Infrastructure element
1843
+ address String? //Address of the PBO FAT
1844
+ splitter1 String? //1:2, 1:4, 1:8 etc
1845
+ splitter2 String?
1846
+ previousEquipmentType String? //Type of the previous equipment
1847
+ previousEquipmentId String? //ID of the previous equipment
1848
+ nextEquipmentType String? //Type of the next equipment
1849
+ nextEquipmentId String? //ID of the next equipment
1850
+ brand String?
1851
+ brandDescription String?
1852
+ materialListReference String? //Reference to the material list
1792
1853
 
1793
1854
  createdAt DateTime @default(now())
1794
1855
  updatedAt DateTime @updatedAt
@@ -1816,6 +1877,13 @@ model PboFat {
1816
1877
  qrCodeTag qrCodeTag[]
1817
1878
  cluster Cluster? @relation(fields: [clusterId], references: [id])
1818
1879
  clusterId String?
1880
+ // cluster relationship but static fields for centraloffice,project, main project etc
1881
+ centralOffice String?
1882
+ projectPhase String?
1883
+ mainProject String?
1884
+ client String?
1885
+ subsidiary String?
1886
+ cables Cable[]
1819
1887
 
1820
1888
  node ElementNode? @relation(fields: [nodeId], references: [id])
1821
1889
  nodeId String?