efiber-prisma-schema 1.12.16 → 1.13.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.
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: Run Prisma Migrations
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- development
|
|
7
|
+
- staging
|
|
8
|
+
- main
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
migrate-development:
|
|
12
|
+
if: github.ref == 'refs/heads/development'
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: development
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup SSH Key
|
|
20
|
+
run: |
|
|
21
|
+
mkdir -p ~/.ssh
|
|
22
|
+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
23
|
+
chmod 600 ~/.ssh/id_rsa
|
|
24
|
+
echo -e "Host *\n StrictHostKeyChecking no\n" > ~/.ssh/config
|
|
25
|
+
|
|
26
|
+
- name: Run Migrations on Development
|
|
27
|
+
run: |
|
|
28
|
+
ssh ${{ secrets.DEVELOPMENT_SSH_USER }}@${{ secrets.DEVELOPMENT_SSH_HOST }} "
|
|
29
|
+
cd efiber-prisma-schema &&
|
|
30
|
+
git reset --hard && git clean -fd && git pull origin development &&
|
|
31
|
+
export PATH=\$PATH:/home/jacob/.nvm/versions/node/v24.7.0/bin &&
|
|
32
|
+
npm ci && npx prisma migrate deploy --schema=./prisma/schema.prisma
|
|
33
|
+
"
|
|
34
|
+
|
|
35
|
+
migrate-staging:
|
|
36
|
+
if: github.ref == 'refs/heads/staging'
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment: staging
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout
|
|
41
|
+
uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Setup SSH Key
|
|
44
|
+
run: |
|
|
45
|
+
mkdir -p ~/.ssh
|
|
46
|
+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
47
|
+
chmod 600 ~/.ssh/id_rsa
|
|
48
|
+
echo -e "Host *\n StrictHostKeyChecking no\n" > ~/.ssh/config
|
|
49
|
+
|
|
50
|
+
- name: Run Migrations on Staging (via Bastion → Prod → Staging)
|
|
51
|
+
run: |
|
|
52
|
+
ssh -J ${{ secrets.BASTION_USER }}@${{ secrets.BASTION_HOST }},${{ secrets.PRODUCTION_SSH_USER }}@${{ secrets.PRODUCTION_SSH_HOST }} \
|
|
53
|
+
${{ secrets.STAGING_SSH_USER }}@${{ secrets.STAGING_SSH_HOST }} "
|
|
54
|
+
cd efiber-prisma-schema &&
|
|
55
|
+
git reset --hard && git clean -fd && git pull origin staging &&
|
|
56
|
+
export PATH=\$PATH:/home/ubuni/.nvm/versions/node/v24.7.0/bin && npm ci &&
|
|
57
|
+
npx prisma migrate deploy --schema=./prisma/schema.prisma
|
|
58
|
+
"
|
|
59
|
+
|
|
60
|
+
migrate-production:
|
|
61
|
+
if: github.ref == 'refs/heads/main'
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
environment: production
|
|
64
|
+
steps:
|
|
65
|
+
- name: Checkout
|
|
66
|
+
uses: actions/checkout@v4
|
|
67
|
+
|
|
68
|
+
- name: Setup SSH Key
|
|
69
|
+
run: |
|
|
70
|
+
mkdir -p ~/.ssh
|
|
71
|
+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
72
|
+
chmod 600 ~/.ssh/id_rsa
|
|
73
|
+
echo -e "Host *\n StrictHostKeyChecking no\n" > ~/.ssh/config
|
|
74
|
+
|
|
75
|
+
- name: Run Migrations on Production (via Bastion)
|
|
76
|
+
run: |
|
|
77
|
+
ssh -J ${{ secrets.BASTION_USER }}@${{ secrets.BASTION_HOST }} \
|
|
78
|
+
${{ secrets.PRODUCTION_SSH_USER }}@${{ secrets.PRODUCTION_SSH_HOST }} "
|
|
79
|
+
cd efiber-prisma-schema &&
|
|
80
|
+
git reset --hard && git clean -fd && git pull origin main &&
|
|
81
|
+
export PATH=\$PATH:/home/ubuni/.nvm/versions/node/v24.7.0/bin && npm ci &&
|
|
82
|
+
npx prisma migrate deploy --schema=./prisma/schema.prisma
|
|
83
|
+
"
|
|
84
|
+
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "AttributeDefinition" ADD COLUMN "visibleOnDispatchMobile" BOOLEAN NOT NULL DEFAULT true;
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "ClusterNotes" (
|
|
6
|
+
"id" TEXT NOT NULL,
|
|
7
|
+
"no" SERIAL NOT NULL,
|
|
8
|
+
"comment" TEXT NOT NULL,
|
|
9
|
+
"hasPicture" BOOLEAN NOT NULL DEFAULT false,
|
|
10
|
+
"coordinates" JSONB,
|
|
11
|
+
"picture" TEXT,
|
|
12
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
14
|
+
"createdById" TEXT NOT NULL,
|
|
15
|
+
"clusterId" TEXT NOT NULL,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "ClusterNotes_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE UNIQUE INDEX "ClusterNotes_id_key" ON "ClusterNotes"("id");
|
|
22
|
+
|
|
23
|
+
-- AddForeignKey
|
|
24
|
+
ALTER TABLE "ClusterNotes" ADD CONSTRAINT "ClusterNotes_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
25
|
+
|
|
26
|
+
-- AddForeignKey
|
|
27
|
+
ALTER TABLE "ClusterNotes" ADD CONSTRAINT "ClusterNotes_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -518,6 +518,9 @@ model User {
|
|
|
518
518
|
ClusterComments ClusterComments[]
|
|
519
519
|
CreatedRevisions Revision[] @relation("revisionCreatedBy")
|
|
520
520
|
ResolvedRevisions Revision[] @relation("revisionResolvedBy")
|
|
521
|
+
ClusterNotes ClusterNotes[]
|
|
522
|
+
Conduit Conduit[]
|
|
523
|
+
ConduitTemplate ConduitTemplate[]
|
|
521
524
|
}
|
|
522
525
|
|
|
523
526
|
model MainProject {
|
|
@@ -568,7 +571,7 @@ model Project {
|
|
|
568
571
|
|
|
569
572
|
pboFatTemplates PboFatTemplate[]
|
|
570
573
|
pboFat PboFat[]
|
|
571
|
-
cableAttributes
|
|
574
|
+
cableAttributes CableAttributes[]
|
|
572
575
|
spliceClosureAttributes SpliceClosureAttributes[]
|
|
573
576
|
Cable Cable[]
|
|
574
577
|
CableTemplate CableTemplate[]
|
|
@@ -594,6 +597,8 @@ model Project {
|
|
|
594
597
|
usersOnline integrationProjectUserStatus[]
|
|
595
598
|
MapElementTemplate MapElementTemplate[]
|
|
596
599
|
MapElement MapElement[]
|
|
600
|
+
ConduitTemplate ConduitTemplate? @relation(fields: [conduitTemplateId], references: [id])
|
|
601
|
+
conduitTemplateId String?
|
|
597
602
|
}
|
|
598
603
|
|
|
599
604
|
model integrationProjectUserStatus {
|
|
@@ -1038,7 +1043,7 @@ model Material {
|
|
|
1038
1043
|
billOfMaterial MaterialBillOfMaterial[]
|
|
1039
1044
|
|
|
1040
1045
|
pboFatAttributes PboFatAttributes[]
|
|
1041
|
-
cableAttributes
|
|
1046
|
+
cableAttributes CableAttributes[]
|
|
1042
1047
|
spliceClosureAttributes SpliceClosureAttributes[]
|
|
1043
1048
|
}
|
|
1044
1049
|
|
|
@@ -1372,6 +1377,8 @@ model NetworkElement {
|
|
|
1372
1377
|
MapElementTemplate MapElementTemplate[]
|
|
1373
1378
|
MapElement MapElement[]
|
|
1374
1379
|
ElementNode ElementNode[]
|
|
1380
|
+
Conduit Conduit[]
|
|
1381
|
+
ConduitTemplate ConduitTemplate[]
|
|
1375
1382
|
}
|
|
1376
1383
|
|
|
1377
1384
|
model ElementNode {
|
|
@@ -1403,6 +1410,7 @@ model ElementNode {
|
|
|
1403
1410
|
SFU SFU[]
|
|
1404
1411
|
Building Building[]
|
|
1405
1412
|
MapElement MapElement[]
|
|
1413
|
+
Conduit Conduit[]
|
|
1406
1414
|
}
|
|
1407
1415
|
|
|
1408
1416
|
model ElementRelation {
|
|
@@ -1429,10 +1437,11 @@ model AttributeDefinition {
|
|
|
1429
1437
|
label String
|
|
1430
1438
|
type AttributeType
|
|
1431
1439
|
|
|
1432
|
-
required
|
|
1433
|
-
visibleOnWeb
|
|
1434
|
-
visibleOnMobile
|
|
1435
|
-
|
|
1440
|
+
required Boolean @default(false)
|
|
1441
|
+
visibleOnWeb Boolean @default(true)
|
|
1442
|
+
visibleOnMobile Boolean @default(true)
|
|
1443
|
+
visibleOnDispatchMobile Boolean @default(true)
|
|
1444
|
+
AttributeValue AttributeValue[]
|
|
1436
1445
|
}
|
|
1437
1446
|
|
|
1438
1447
|
model OptionSource {
|
|
@@ -1509,12 +1518,14 @@ model Cable {
|
|
|
1509
1518
|
installation NetworkElementInstallation? @relation(fields: [installationId], references: [id])
|
|
1510
1519
|
installationId String?
|
|
1511
1520
|
|
|
1512
|
-
cableAttributes
|
|
1521
|
+
cableAttributes CableAttributes[]
|
|
1513
1522
|
PboFatAttributes PboFatAttributes[]
|
|
1514
1523
|
qrCodeTag qrCodeTag[]
|
|
1515
1524
|
cluster Cluster? @relation(fields: [clusterId], references: [id])
|
|
1516
1525
|
clusterId String?
|
|
1517
1526
|
Revision Revision[]
|
|
1527
|
+
Duct Duct? @relation(fields: [ductId], references: [id])
|
|
1528
|
+
ductId String?
|
|
1518
1529
|
}
|
|
1519
1530
|
|
|
1520
1531
|
model CableTemplate {
|
|
@@ -1546,14 +1557,134 @@ model CableTemplate {
|
|
|
1546
1557
|
|
|
1547
1558
|
projects Project[]
|
|
1548
1559
|
|
|
1549
|
-
cableAttributes
|
|
1560
|
+
cableAttributes CableAttributes[]
|
|
1550
1561
|
qrCodeTemplate qrCodeTemplate[]
|
|
1551
1562
|
Cable Cable[]
|
|
1552
1563
|
cluster Cluster? @relation(fields: [clusterId], references: [id])
|
|
1553
1564
|
clusterId String?
|
|
1554
1565
|
}
|
|
1555
1566
|
|
|
1556
|
-
model
|
|
1567
|
+
model Conduit {
|
|
1568
|
+
id String @id @unique @default(uuid())
|
|
1569
|
+
no Int @default(autoincrement())
|
|
1570
|
+
|
|
1571
|
+
status String @default("active")
|
|
1572
|
+
name String
|
|
1573
|
+
terminalAccess Boolean @default(false)
|
|
1574
|
+
photos Json? //Upload files for photos
|
|
1575
|
+
texts Json? //Add text attributes to the conduit
|
|
1576
|
+
files Json? //Upload files for the conduit
|
|
1577
|
+
zone Json? //Color code for zone
|
|
1578
|
+
geometry Json? //Icon for the conduit
|
|
1579
|
+
attributes Json? //Attributes for the conduit
|
|
1580
|
+
|
|
1581
|
+
createdAt DateTime @default(now())
|
|
1582
|
+
updatedAt DateTime @updatedAt
|
|
1583
|
+
deletedAt DateTime?
|
|
1584
|
+
|
|
1585
|
+
asBuiltCoordinates Json? //As built coordinates
|
|
1586
|
+
isInstalled Boolean @default(false)
|
|
1587
|
+
installationDate DateTime?
|
|
1588
|
+
|
|
1589
|
+
isInRevision Boolean @default(false)
|
|
1590
|
+
installationStatus String? @default("pending") //pending, approved, in-revision
|
|
1591
|
+
|
|
1592
|
+
comments String?
|
|
1593
|
+
|
|
1594
|
+
updatedBy User? @relation(fields: [updatedById], references: [id])
|
|
1595
|
+
updatedById String?
|
|
1596
|
+
|
|
1597
|
+
networkElement NetworkElement @relation(fields: [networkElementId], references: [id])
|
|
1598
|
+
networkElementId String
|
|
1599
|
+
|
|
1600
|
+
node ElementNode? @relation(fields: [nodeId], references: [id])
|
|
1601
|
+
nodeId String?
|
|
1602
|
+
|
|
1603
|
+
installation NetworkElementInstallation? @relation(fields: [installationId], references: [id])
|
|
1604
|
+
installationId String?
|
|
1605
|
+
|
|
1606
|
+
template ConduitTemplate? @relation(fields: [templateId], references: [id])
|
|
1607
|
+
templateId String?
|
|
1608
|
+
|
|
1609
|
+
cluster Cluster? @relation(fields: [clusterId], references: [id])
|
|
1610
|
+
clusterId String?
|
|
1611
|
+
qrCodeTag qrCodeTag[]
|
|
1612
|
+
ducts Duct[]
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
model Duct {
|
|
1616
|
+
id String @id @unique @default(uuid())
|
|
1617
|
+
no Int @default(autoincrement())
|
|
1618
|
+
|
|
1619
|
+
type String
|
|
1620
|
+
material String
|
|
1621
|
+
dimension Float
|
|
1622
|
+
typeOptions String[]
|
|
1623
|
+
materialOptions String[]
|
|
1624
|
+
|
|
1625
|
+
createdAt DateTime @default(now())
|
|
1626
|
+
updatedAt DateTime @updatedAt
|
|
1627
|
+
deletedAt DateTime?
|
|
1628
|
+
|
|
1629
|
+
conduit Conduit @relation(fields: [conduitId], references: [id])
|
|
1630
|
+
conduitId String
|
|
1631
|
+
|
|
1632
|
+
cables Cable[]
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
model ductTemplate {
|
|
1636
|
+
id String @id @unique @default(uuid())
|
|
1637
|
+
no Int @default(autoincrement())
|
|
1638
|
+
|
|
1639
|
+
type String
|
|
1640
|
+
material String
|
|
1641
|
+
dimension Float
|
|
1642
|
+
|
|
1643
|
+
typeOptions String[]
|
|
1644
|
+
materialOptions String[]
|
|
1645
|
+
|
|
1646
|
+
createdAt DateTime @default(now())
|
|
1647
|
+
updatedAt DateTime @updatedAt
|
|
1648
|
+
deletedAt DateTime?
|
|
1649
|
+
|
|
1650
|
+
conduit ConduitTemplate @relation(fields: [conduitTemplateId], references: [id])
|
|
1651
|
+
conduitTemplateId String
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
model ConduitTemplate {
|
|
1655
|
+
id String @id @unique @default(uuid())
|
|
1656
|
+
no Int @default(autoincrement())
|
|
1657
|
+
|
|
1658
|
+
status String @default("active")
|
|
1659
|
+
name String
|
|
1660
|
+
terminalAccess Boolean @default(false)
|
|
1661
|
+
photos Json? //Upload files for photos
|
|
1662
|
+
texts Json? //Add text attributes to the conduit
|
|
1663
|
+
files Json? //Upload files for the conduit
|
|
1664
|
+
zone Json? //Color code for zone
|
|
1665
|
+
geometry Json? //Icon for the conduit
|
|
1666
|
+
attributes Json? //Attributes for the conduit
|
|
1667
|
+
|
|
1668
|
+
createdAt DateTime @default(now())
|
|
1669
|
+
updatedAt DateTime @updatedAt
|
|
1670
|
+
deletedAt DateTime?
|
|
1671
|
+
|
|
1672
|
+
updatedBy User? @relation(fields: [updatedById], references: [id])
|
|
1673
|
+
updatedById String?
|
|
1674
|
+
|
|
1675
|
+
networkElement NetworkElement @relation(fields: [networkElementId], references: [id])
|
|
1676
|
+
networkElementId String
|
|
1677
|
+
|
|
1678
|
+
projects Project[]
|
|
1679
|
+
Conduit Conduit[]
|
|
1680
|
+
|
|
1681
|
+
cluster Cluster? @relation(fields: [clusterId], references: [id])
|
|
1682
|
+
clusterId String?
|
|
1683
|
+
qrCodeTemplate qrCodeTemplate[]
|
|
1684
|
+
ductTemplates ductTemplate[]
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
model CableAttributes {
|
|
1557
1688
|
id String @id @unique @default(uuid())
|
|
1558
1689
|
no Int @default(autoincrement())
|
|
1559
1690
|
name String
|
|
@@ -2626,6 +2757,7 @@ model NetworkElementInstallation {
|
|
|
2626
2757
|
FDTSRO FDTSRO[]
|
|
2627
2758
|
SFU SFU[]
|
|
2628
2759
|
Building Building[]
|
|
2760
|
+
Conduit Conduit[]
|
|
2629
2761
|
}
|
|
2630
2762
|
|
|
2631
2763
|
model CentralOffice {
|
|
@@ -2697,6 +2829,9 @@ model Cluster {
|
|
|
2697
2829
|
ClusterComments ClusterComments[]
|
|
2698
2830
|
Revision Revision[]
|
|
2699
2831
|
ElementRelation ElementRelation[]
|
|
2832
|
+
ClusterNotes ClusterNotes[]
|
|
2833
|
+
Conduit Conduit[]
|
|
2834
|
+
ConduitTemplate ConduitTemplate[]
|
|
2700
2835
|
}
|
|
2701
2836
|
|
|
2702
2837
|
model ClusterComments {
|
|
@@ -2716,6 +2851,25 @@ model ClusterComments {
|
|
|
2716
2851
|
clusterId String
|
|
2717
2852
|
}
|
|
2718
2853
|
|
|
2854
|
+
model ClusterNotes {
|
|
2855
|
+
id String @id @unique @default(uuid())
|
|
2856
|
+
no Int @default(autoincrement())
|
|
2857
|
+
|
|
2858
|
+
comment String
|
|
2859
|
+
hasPicture Boolean @default(false)
|
|
2860
|
+
coordinates Json?
|
|
2861
|
+
picture String?
|
|
2862
|
+
|
|
2863
|
+
createdAt DateTime @default(now())
|
|
2864
|
+
updatedAt DateTime @updatedAt
|
|
2865
|
+
|
|
2866
|
+
createdBy User @relation(fields: [createdById], references: [id])
|
|
2867
|
+
createdById String
|
|
2868
|
+
|
|
2869
|
+
cluster Cluster @relation(fields: [clusterId], references: [id])
|
|
2870
|
+
clusterId String
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2719
2873
|
model CentralOfficeTeam {
|
|
2720
2874
|
id String @id @unique @default(uuid())
|
|
2721
2875
|
no Int @default(autoincrement())
|
|
@@ -2809,6 +2963,9 @@ model qrCodeTemplate {
|
|
|
2809
2963
|
qrCodeTag qrCodeTag[]
|
|
2810
2964
|
MapElementTemplate MapElementTemplate? @relation(fields: [mapElementTemplateId], references: [id])
|
|
2811
2965
|
mapElementTemplateId String?
|
|
2966
|
+
|
|
2967
|
+
conduitTemplate ConduitTemplate? @relation(fields: [conduitTemplateId], references: [id])
|
|
2968
|
+
conduitTemplateId String?
|
|
2812
2969
|
}
|
|
2813
2970
|
|
|
2814
2971
|
model qrCodeTag {
|
|
@@ -2860,6 +3017,9 @@ model qrCodeTag {
|
|
|
2860
3017
|
buildingId String?
|
|
2861
3018
|
MapElement MapElement? @relation(fields: [mapElementId], references: [id])
|
|
2862
3019
|
mapElementId String?
|
|
3020
|
+
|
|
3021
|
+
conduit Conduit? @relation(fields: [conduitId], references: [id])
|
|
3022
|
+
conduitId String?
|
|
2863
3023
|
}
|
|
2864
3024
|
|
|
2865
3025
|
model installationSequence {
|