efiber-prisma-schema 1.14.1 → 1.16.0

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.14.1",
3
+ "version": "1.16.0",
4
4
  "description": "Database schema for eFiber",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,23 @@
1
+ -- CreateTable
2
+ CREATE TABLE "WorkOrderComments" (
3
+ "id" TEXT NOT NULL,
4
+ "no" SERIAL NOT NULL,
5
+ "comment" TEXT NOT NULL,
6
+ "hasAttachment" BOOLEAN NOT NULL DEFAULT false,
7
+ "attachment" TEXT,
8
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
9
+ "updatedAt" TIMESTAMP(3) NOT NULL,
10
+ "workOrderId" TEXT NOT NULL,
11
+ "createdById" TEXT,
12
+
13
+ CONSTRAINT "WorkOrderComments_pkey" PRIMARY KEY ("id")
14
+ );
15
+
16
+ -- CreateIndex
17
+ CREATE UNIQUE INDEX "WorkOrderComments_id_key" ON "WorkOrderComments"("id");
18
+
19
+ -- AddForeignKey
20
+ ALTER TABLE "WorkOrderComments" ADD CONSTRAINT "WorkOrderComments_workOrderId_fkey" FOREIGN KEY ("workOrderId") REFERENCES "WorkOrder"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
21
+
22
+ -- AddForeignKey
23
+ ALTER TABLE "WorkOrderComments" ADD CONSTRAINT "WorkOrderComments_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -526,6 +526,7 @@ model User {
526
526
  ClusterNotes ClusterNotes[]
527
527
  Conduit Conduit[]
528
528
  ConduitTemplate ConduitTemplate[]
529
+ WorkOrderComments WorkOrderComments[]
529
530
  }
530
531
 
531
532
  model MainProject {
@@ -899,6 +900,7 @@ model WorkOrder {
899
900
  Building Building? @relation(fields: [buildingId], references: [id])
900
901
  buildingId String?
901
902
  WorkOrderPauses WorkOrderPauses[]
903
+ WorkOrderComments WorkOrderComments[]
902
904
  }
903
905
 
904
906
  model WorkOrderChannel {
@@ -1017,6 +1019,23 @@ model WorkOrderPauses {
1017
1019
  workOrderId String
1018
1020
  }
1019
1021
 
1022
+ model WorkOrderComments {
1023
+ id String @id @unique @default(uuid())
1024
+ no Int @default(autoincrement())
1025
+ comment String
1026
+ hasAttachment Boolean @default(false)
1027
+ attachment String? @db.Text //Upload file for attachment
1028
+
1029
+ createdAt DateTime @default(now())
1030
+ updatedAt DateTime @updatedAt
1031
+
1032
+ workOrder WorkOrder @relation(fields: [workOrderId], references: [id])
1033
+ workOrderId String
1034
+
1035
+ createdBy User? @relation(fields: [createdById], references: [id])
1036
+ createdById String?
1037
+ }
1038
+
1020
1039
  // Houses the materials of a project
1021
1040
  model BillOfMaterial {
1022
1041
  id String @id @unique @default(uuid())
@@ -1521,6 +1540,15 @@ model Cable {
1521
1540
  client String? //Client associated with the cable
1522
1541
  subsidiary String? //Subsidiary or branch
1523
1542
 
1543
+ // parent/subcable implementation
1544
+ isSubcable Boolean @default(false)
1545
+
1546
+ parentCable Cable? @relation("CableToSubcables", fields: [parentCableId], references: [id])
1547
+ parentCableId String?
1548
+ parentCableName String?
1549
+
1550
+ subcables Cable[] @relation("CableToSubcables")
1551
+
1524
1552
  createdAt DateTime @default(now())
1525
1553
  updatedAt DateTime @updatedAt
1526
1554
  deletedAt DateTime?