efiber-prisma-schema 1.12.17 → 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.
- package/.github/workflows/main.yml +84 -0
- package/package.json +1 -1
- package/prisma/schema.prisma +146 -8
|
@@ -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
package/prisma/schema.prisma
CHANGED
|
@@ -519,6 +519,8 @@ model User {
|
|
|
519
519
|
CreatedRevisions Revision[] @relation("revisionCreatedBy")
|
|
520
520
|
ResolvedRevisions Revision[] @relation("revisionResolvedBy")
|
|
521
521
|
ClusterNotes ClusterNotes[]
|
|
522
|
+
Conduit Conduit[]
|
|
523
|
+
ConduitTemplate ConduitTemplate[]
|
|
522
524
|
}
|
|
523
525
|
|
|
524
526
|
model MainProject {
|
|
@@ -569,7 +571,7 @@ model Project {
|
|
|
569
571
|
|
|
570
572
|
pboFatTemplates PboFatTemplate[]
|
|
571
573
|
pboFat PboFat[]
|
|
572
|
-
cableAttributes
|
|
574
|
+
cableAttributes CableAttributes[]
|
|
573
575
|
spliceClosureAttributes SpliceClosureAttributes[]
|
|
574
576
|
Cable Cable[]
|
|
575
577
|
CableTemplate CableTemplate[]
|
|
@@ -595,6 +597,8 @@ model Project {
|
|
|
595
597
|
usersOnline integrationProjectUserStatus[]
|
|
596
598
|
MapElementTemplate MapElementTemplate[]
|
|
597
599
|
MapElement MapElement[]
|
|
600
|
+
ConduitTemplate ConduitTemplate? @relation(fields: [conduitTemplateId], references: [id])
|
|
601
|
+
conduitTemplateId String?
|
|
598
602
|
}
|
|
599
603
|
|
|
600
604
|
model integrationProjectUserStatus {
|
|
@@ -1039,7 +1043,7 @@ model Material {
|
|
|
1039
1043
|
billOfMaterial MaterialBillOfMaterial[]
|
|
1040
1044
|
|
|
1041
1045
|
pboFatAttributes PboFatAttributes[]
|
|
1042
|
-
cableAttributes
|
|
1046
|
+
cableAttributes CableAttributes[]
|
|
1043
1047
|
spliceClosureAttributes SpliceClosureAttributes[]
|
|
1044
1048
|
}
|
|
1045
1049
|
|
|
@@ -1373,6 +1377,8 @@ model NetworkElement {
|
|
|
1373
1377
|
MapElementTemplate MapElementTemplate[]
|
|
1374
1378
|
MapElement MapElement[]
|
|
1375
1379
|
ElementNode ElementNode[]
|
|
1380
|
+
Conduit Conduit[]
|
|
1381
|
+
ConduitTemplate ConduitTemplate[]
|
|
1376
1382
|
}
|
|
1377
1383
|
|
|
1378
1384
|
model ElementNode {
|
|
@@ -1404,6 +1410,7 @@ model ElementNode {
|
|
|
1404
1410
|
SFU SFU[]
|
|
1405
1411
|
Building Building[]
|
|
1406
1412
|
MapElement MapElement[]
|
|
1413
|
+
Conduit Conduit[]
|
|
1407
1414
|
}
|
|
1408
1415
|
|
|
1409
1416
|
model ElementRelation {
|
|
@@ -1511,12 +1518,14 @@ model Cable {
|
|
|
1511
1518
|
installation NetworkElementInstallation? @relation(fields: [installationId], references: [id])
|
|
1512
1519
|
installationId String?
|
|
1513
1520
|
|
|
1514
|
-
cableAttributes
|
|
1521
|
+
cableAttributes CableAttributes[]
|
|
1515
1522
|
PboFatAttributes PboFatAttributes[]
|
|
1516
1523
|
qrCodeTag qrCodeTag[]
|
|
1517
1524
|
cluster Cluster? @relation(fields: [clusterId], references: [id])
|
|
1518
1525
|
clusterId String?
|
|
1519
1526
|
Revision Revision[]
|
|
1527
|
+
Duct Duct? @relation(fields: [ductId], references: [id])
|
|
1528
|
+
ductId String?
|
|
1520
1529
|
}
|
|
1521
1530
|
|
|
1522
1531
|
model CableTemplate {
|
|
@@ -1548,14 +1557,134 @@ model CableTemplate {
|
|
|
1548
1557
|
|
|
1549
1558
|
projects Project[]
|
|
1550
1559
|
|
|
1551
|
-
cableAttributes
|
|
1560
|
+
cableAttributes CableAttributes[]
|
|
1552
1561
|
qrCodeTemplate qrCodeTemplate[]
|
|
1553
1562
|
Cable Cable[]
|
|
1554
1563
|
cluster Cluster? @relation(fields: [clusterId], references: [id])
|
|
1555
1564
|
clusterId String?
|
|
1556
1565
|
}
|
|
1557
1566
|
|
|
1558
|
-
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 {
|
|
1559
1688
|
id String @id @unique @default(uuid())
|
|
1560
1689
|
no Int @default(autoincrement())
|
|
1561
1690
|
name String
|
|
@@ -2628,6 +2757,7 @@ model NetworkElementInstallation {
|
|
|
2628
2757
|
FDTSRO FDTSRO[]
|
|
2629
2758
|
SFU SFU[]
|
|
2630
2759
|
Building Building[]
|
|
2760
|
+
Conduit Conduit[]
|
|
2631
2761
|
}
|
|
2632
2762
|
|
|
2633
2763
|
model CentralOffice {
|
|
@@ -2700,6 +2830,8 @@ model Cluster {
|
|
|
2700
2830
|
Revision Revision[]
|
|
2701
2831
|
ElementRelation ElementRelation[]
|
|
2702
2832
|
ClusterNotes ClusterNotes[]
|
|
2833
|
+
Conduit Conduit[]
|
|
2834
|
+
ConduitTemplate ConduitTemplate[]
|
|
2703
2835
|
}
|
|
2704
2836
|
|
|
2705
2837
|
model ClusterComments {
|
|
@@ -2723,10 +2855,10 @@ model ClusterNotes {
|
|
|
2723
2855
|
id String @id @unique @default(uuid())
|
|
2724
2856
|
no Int @default(autoincrement())
|
|
2725
2857
|
|
|
2726
|
-
comment
|
|
2727
|
-
hasPicture
|
|
2858
|
+
comment String
|
|
2859
|
+
hasPicture Boolean @default(false)
|
|
2728
2860
|
coordinates Json?
|
|
2729
|
-
picture
|
|
2861
|
+
picture String?
|
|
2730
2862
|
|
|
2731
2863
|
createdAt DateTime @default(now())
|
|
2732
2864
|
updatedAt DateTime @updatedAt
|
|
@@ -2831,6 +2963,9 @@ model qrCodeTemplate {
|
|
|
2831
2963
|
qrCodeTag qrCodeTag[]
|
|
2832
2964
|
MapElementTemplate MapElementTemplate? @relation(fields: [mapElementTemplateId], references: [id])
|
|
2833
2965
|
mapElementTemplateId String?
|
|
2966
|
+
|
|
2967
|
+
conduitTemplate ConduitTemplate? @relation(fields: [conduitTemplateId], references: [id])
|
|
2968
|
+
conduitTemplateId String?
|
|
2834
2969
|
}
|
|
2835
2970
|
|
|
2836
2971
|
model qrCodeTag {
|
|
@@ -2882,6 +3017,9 @@ model qrCodeTag {
|
|
|
2882
3017
|
buildingId String?
|
|
2883
3018
|
MapElement MapElement? @relation(fields: [mapElementId], references: [id])
|
|
2884
3019
|
mapElementId String?
|
|
3020
|
+
|
|
3021
|
+
conduit Conduit? @relation(fields: [conduitId], references: [id])
|
|
3022
|
+
conduitId String?
|
|
2885
3023
|
}
|
|
2886
3024
|
|
|
2887
3025
|
model installationSequence {
|