@bslau/hmm_prisma_schema 1.1.15 → 1.1.17
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 +1 -1
- package/prisma/migrations/20250203232957_hmh_comment/migration.sql +33 -0
- package/prisma/migrations/20250207045940_test_migration_2/migration.sql +19 -0
- package/prisma/migrations/20250207051346_undo_test_migration_2/migration.sql +25 -0
- package/prisma/migrations/20250310223608_393038_torpedo_state/migration.sql +32 -0
- package/prisma/schema.prisma +97 -75
- package/prisma/seed.ts +547 -517
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE [dbo].[Torpedo] ADD [hmhSixPitRestrictionFlag] BIT NOT NULL CONSTRAINT [Torpedo_hmhSixPitRestrictionFlag_df] DEFAULT 0;
|
|
7
|
+
|
|
8
|
+
-- CreateTable
|
|
9
|
+
CREATE TABLE [dbo].[HMHComment] (
|
|
10
|
+
[id] INT NOT NULL IDENTITY(1,1),
|
|
11
|
+
[torpedoId] INT NOT NULL,
|
|
12
|
+
[comment] NVARCHAR(1000) NOT NULL,
|
|
13
|
+
[isRemoved] BIT NOT NULL CONSTRAINT [HMHComment_isRemoved_df] DEFAULT 0,
|
|
14
|
+
[createdAt] DATETIME2 NOT NULL CONSTRAINT [HMHComment_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
|
|
15
|
+
[updatedAt] DATETIME2,
|
|
16
|
+
CONSTRAINT [HMHComment_pkey] PRIMARY KEY CLUSTERED ([id])
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- AddForeignKey
|
|
20
|
+
ALTER TABLE [dbo].[HMHComment] ADD CONSTRAINT [HMHComment_torpedoId_fkey] FOREIGN KEY ([torpedoId]) REFERENCES [dbo].[Torpedo]([torpedoId]) ON DELETE NO ACTION ON UPDATE CASCADE;
|
|
21
|
+
|
|
22
|
+
COMMIT TRAN;
|
|
23
|
+
|
|
24
|
+
END TRY
|
|
25
|
+
BEGIN CATCH
|
|
26
|
+
|
|
27
|
+
IF @@TRANCOUNT > 0
|
|
28
|
+
BEGIN
|
|
29
|
+
ROLLBACK TRAN;
|
|
30
|
+
END;
|
|
31
|
+
THROW
|
|
32
|
+
|
|
33
|
+
END CATCH
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `test` on the `Station` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
BEGIN TRY
|
|
8
|
+
|
|
9
|
+
BEGIN TRAN;
|
|
10
|
+
|
|
11
|
+
-- AlterTable
|
|
12
|
+
ALTER TABLE [dbo].[Station] DROP COLUMN [test];
|
|
13
|
+
|
|
14
|
+
COMMIT TRAN;
|
|
15
|
+
|
|
16
|
+
END TRY
|
|
17
|
+
BEGIN CATCH
|
|
18
|
+
|
|
19
|
+
IF @@TRANCOUNT > 0
|
|
20
|
+
BEGIN
|
|
21
|
+
ROLLBACK TRAN;
|
|
22
|
+
END;
|
|
23
|
+
THROW
|
|
24
|
+
|
|
25
|
+
END CATCH
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE [dbo].[Torpedo] ADD [torpedoStateId] INT;
|
|
7
|
+
|
|
8
|
+
-- CreateTable
|
|
9
|
+
CREATE TABLE [dbo].[TorpedoState] (
|
|
10
|
+
[id] INT NOT NULL IDENTITY(1,1),
|
|
11
|
+
[name] NVARCHAR(1000) NOT NULL,
|
|
12
|
+
[label] NVARCHAR(1000) NOT NULL,
|
|
13
|
+
[description] NVARCHAR(1000) NOT NULL,
|
|
14
|
+
CONSTRAINT [TorpedoState_pkey] PRIMARY KEY CLUSTERED ([id]),
|
|
15
|
+
CONSTRAINT [TorpedoState_name_key] UNIQUE NONCLUSTERED ([name])
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
-- AddForeignKey
|
|
19
|
+
ALTER TABLE [dbo].[Torpedo] ADD CONSTRAINT [Torpedo_torpedoStateId_fkey] FOREIGN KEY ([torpedoStateId]) REFERENCES [dbo].[TorpedoState]([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
20
|
+
|
|
21
|
+
COMMIT TRAN;
|
|
22
|
+
|
|
23
|
+
END TRY
|
|
24
|
+
BEGIN CATCH
|
|
25
|
+
|
|
26
|
+
IF @@TRANCOUNT > 0
|
|
27
|
+
BEGIN
|
|
28
|
+
ROLLBACK TRAN;
|
|
29
|
+
END;
|
|
30
|
+
THROW
|
|
31
|
+
|
|
32
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -53,6 +53,44 @@ model Cast {
|
|
|
53
53
|
hotMetalCollection HotMetal[]
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
model EventTorpedoMovement {
|
|
57
|
+
id Int @id @default(autoincrement())
|
|
58
|
+
torpedoId Int
|
|
59
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId])
|
|
60
|
+
eventTime DateTime @db.DateTimeOffset
|
|
61
|
+
originStation Station @relation(name: "originStation-movement", fields: [originStationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
62
|
+
originStationId Int
|
|
63
|
+
originLocation Location @relation(name: "originLocation-movement", fields: [originLocationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
64
|
+
originLocationId Int
|
|
65
|
+
destinationStation Station @relation(name: "destinationStation-movement", fields: [destinationStationId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
66
|
+
destinationStationId Int
|
|
67
|
+
destinationLocation Location @relation(name: "destinationLocation-movement", fields: [destinationLocationId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
68
|
+
destinationLocationId Int
|
|
69
|
+
event EventTracker @relation(fields: [eventId], references: [id])
|
|
70
|
+
eventId Int @unique
|
|
71
|
+
userId String?
|
|
72
|
+
createdAt DateTime @default(now())
|
|
73
|
+
updatedAt DateTime @updatedAt
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
model EventTracker {
|
|
77
|
+
id Int @id @default(autoincrement())
|
|
78
|
+
eventTime DateTime @db.DateTimeOffset
|
|
79
|
+
eventType String
|
|
80
|
+
userId String?
|
|
81
|
+
torpedoMovement EventTorpedoMovement?
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
model HMHComment {
|
|
85
|
+
id Int @id @default(autoincrement())
|
|
86
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
|
|
87
|
+
torpedoId Int
|
|
88
|
+
comment String
|
|
89
|
+
isRemoved Boolean @default(false)
|
|
90
|
+
createdAt DateTime @default(now())
|
|
91
|
+
updatedAt DateTime? @updatedAt
|
|
92
|
+
}
|
|
93
|
+
|
|
56
94
|
model HotMetal {
|
|
57
95
|
id Int @id @default(autoincrement())
|
|
58
96
|
mesId Int?
|
|
@@ -113,46 +151,6 @@ model HotMetal {
|
|
|
113
151
|
@@unique(name: "cast_torpedo_id", [castSequence, torpedoId])
|
|
114
152
|
}
|
|
115
153
|
|
|
116
|
-
model Torpedo {
|
|
117
|
-
id Int @id @default(autoincrement())
|
|
118
|
-
torpedoId Int @unique(sort: Desc)
|
|
119
|
-
name String?
|
|
120
|
-
description String?
|
|
121
|
-
futureLocation String?
|
|
122
|
-
addAlPucksFlag Boolean @default(false)
|
|
123
|
-
heatUpFlag Boolean @default(false)
|
|
124
|
-
heatUpStartTime DateTime? @db.DateTimeOffset
|
|
125
|
-
onGasFlag Boolean @default(false)
|
|
126
|
-
onGasEndDate DateTime? @db.DateTimeOffset
|
|
127
|
-
sixPitRestrictionFlag Boolean @default(false)
|
|
128
|
-
sixPitRestrictionEndTime DateTime? @db.DateTimeOffset
|
|
129
|
-
status Int @default(2)
|
|
130
|
-
// sixPitStart DateTime?
|
|
131
|
-
// capacityDynamic Float?
|
|
132
|
-
// capacityNominal Float?
|
|
133
|
-
// comments String?
|
|
134
|
-
// emptyWeight Float?
|
|
135
|
-
// gasStart DateTime?
|
|
136
|
-
hotMetalCollection HotMetal[]
|
|
137
|
-
torpedoLocation TorpedoLocation?
|
|
138
|
-
torpedoComments TorpedoComment[]
|
|
139
|
-
eventsTorpedoMovement EventTorpedoMovement[]
|
|
140
|
-
createdAt DateTime @default(now())
|
|
141
|
-
updatedAt DateTime @updatedAt
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
model Station {
|
|
145
|
-
id Int @id @default(autoincrement())
|
|
146
|
-
name String
|
|
147
|
-
value String @unique
|
|
148
|
-
createdAt DateTime @default(now())
|
|
149
|
-
updatedAt DateTime @updatedAt
|
|
150
|
-
torpedoLocations TorpedoLocation[]
|
|
151
|
-
locations Location[]
|
|
152
|
-
eventsTorpedoMovementOrigin EventTorpedoMovement[] @relation(name: "originStation-movement")
|
|
153
|
-
eventsTorpedoMovementDestination EventTorpedoMovement[] @relation(name: "destinationStation-movement")
|
|
154
|
-
}
|
|
155
|
-
|
|
156
154
|
model HotMetalLabResult {
|
|
157
155
|
id Int @id @default(autoincrement())
|
|
158
156
|
testSampleId String @unique(sort: Desc)
|
|
@@ -188,18 +186,48 @@ model Location {
|
|
|
188
186
|
torpedoLocations TorpedoLocation[]
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
model
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
189
|
+
model Station {
|
|
190
|
+
id Int @id @default(autoincrement())
|
|
191
|
+
name String
|
|
192
|
+
value String @unique
|
|
193
|
+
createdAt DateTime @default(now())
|
|
194
|
+
updatedAt DateTime @updatedAt
|
|
195
|
+
torpedoLocations TorpedoLocation[]
|
|
196
|
+
locations Location[]
|
|
197
|
+
eventsTorpedoMovementOrigin EventTorpedoMovement[] @relation(name: "originStation-movement")
|
|
198
|
+
eventsTorpedoMovementDestination EventTorpedoMovement[] @relation(name: "destinationStation-movement")
|
|
199
|
+
}
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
model Torpedo {
|
|
202
|
+
id Int @id @default(autoincrement())
|
|
203
|
+
torpedoId Int @unique(sort: Desc)
|
|
204
|
+
name String?
|
|
205
|
+
description String?
|
|
206
|
+
futureLocation String?
|
|
207
|
+
addAlPucksFlag Boolean @default(false)
|
|
208
|
+
heatUpFlag Boolean @default(false)
|
|
209
|
+
heatUpStartTime DateTime? @db.DateTimeOffset
|
|
210
|
+
onGasFlag Boolean @default(false)
|
|
211
|
+
onGasEndDate DateTime? @db.DateTimeOffset
|
|
212
|
+
hmhSixPitRestrictionFlag Boolean @default(false)
|
|
213
|
+
sixPitRestrictionFlag Boolean @default(false)
|
|
214
|
+
sixPitRestrictionEndTime DateTime? @db.DateTimeOffset
|
|
215
|
+
status Int @default(2)
|
|
216
|
+
// sixPitStart DateTime?
|
|
217
|
+
// capacityDynamic Float?
|
|
218
|
+
// capacityNominal Float?
|
|
219
|
+
// comments String?
|
|
220
|
+
// emptyWeight Float?
|
|
221
|
+
// gasStart DateTime?
|
|
222
|
+
hotMetalCollection HotMetal[]
|
|
223
|
+
torpedoLocation TorpedoLocation?
|
|
224
|
+
torpedoComments TorpedoComment[]
|
|
225
|
+
hmhComments HMHComment[]
|
|
226
|
+
eventsTorpedoMovement EventTorpedoMovement[]
|
|
227
|
+
torpedoState TorpedoState? @relation(fields: [torpedoStateId], references: [id])
|
|
228
|
+
torpedoStateId Int?
|
|
229
|
+
createdAt DateTime @default(now())
|
|
230
|
+
updatedAt DateTime @updatedAt
|
|
203
231
|
}
|
|
204
232
|
|
|
205
233
|
model TorpedoComment {
|
|
@@ -212,30 +240,24 @@ model TorpedoComment {
|
|
|
212
240
|
updatedAt DateTime? @updatedAt
|
|
213
241
|
}
|
|
214
242
|
|
|
215
|
-
model
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
243
|
+
model TorpedoLocation {
|
|
244
|
+
stationId Int
|
|
245
|
+
station Station @relation(fields: [stationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
246
|
+
position Int
|
|
247
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
|
|
248
|
+
torpedoId Int @unique
|
|
249
|
+
locationId Int
|
|
250
|
+
location Location @relation(fields: [locationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
251
|
+
createdAt DateTime @default(now())
|
|
252
|
+
updatedAt DateTime @updatedAt
|
|
253
|
+
|
|
254
|
+
@@id([stationId, position])
|
|
221
255
|
}
|
|
222
256
|
|
|
223
|
-
model
|
|
224
|
-
id
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
originStationId Int
|
|
230
|
-
originLocation Location @relation(name: "originLocation-movement", fields: [originLocationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
231
|
-
originLocationId Int
|
|
232
|
-
destinationStation Station @relation(name: "destinationStation-movement", fields: [destinationStationId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
233
|
-
destinationStationId Int
|
|
234
|
-
destinationLocation Location @relation(name: "destinationLocation-movement", fields: [destinationLocationId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
235
|
-
destinationLocationId Int
|
|
236
|
-
event EventTracker @relation(fields: [eventId], references: [id])
|
|
237
|
-
eventId Int @unique
|
|
238
|
-
userId String?
|
|
239
|
-
createdAt DateTime @default(now())
|
|
240
|
-
updatedAt DateTime @updatedAt
|
|
257
|
+
model TorpedoState {
|
|
258
|
+
id Int @id @default(autoincrement())
|
|
259
|
+
name String @unique
|
|
260
|
+
label String
|
|
261
|
+
description String
|
|
262
|
+
torpedoes Torpedo[]
|
|
241
263
|
}
|
package/prisma/seed.ts
CHANGED
|
@@ -1,537 +1,567 @@
|
|
|
1
|
-
|
|
2
1
|
import _ from "underscore";
|
|
3
2
|
import prisma from "./dbClient";
|
|
4
3
|
|
|
5
4
|
async function main() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
connectOrCreate: [
|
|
12
|
-
{
|
|
13
|
-
where: {
|
|
14
|
-
value: "WPR",
|
|
15
|
-
},
|
|
16
|
-
create: {
|
|
17
|
-
value: "WPR",
|
|
18
|
-
name: "Woodpecker Repair Lines",
|
|
5
|
+
// SEED: Station
|
|
6
|
+
if (await prisma.station.count() > 0) {
|
|
7
|
+
console.log("SEED: Station - skipped.");
|
|
8
|
+
} else {
|
|
9
|
+
console.log("SEED: Station - generating...");
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
value: "5BF",
|
|
34
|
-
},
|
|
35
|
-
create: {
|
|
36
|
-
value: "5BF",
|
|
37
|
-
name: "5 Blast Furnace",
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
where: {
|
|
42
|
-
value: "OPM",
|
|
43
|
-
},
|
|
44
|
-
create: {
|
|
45
|
-
value: "OPM",
|
|
46
|
-
name: "Old Plug Mill",
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
where: {
|
|
51
|
-
value: "XOVR",
|
|
52
|
-
},
|
|
53
|
-
create: {
|
|
54
|
-
value: "XOVR",
|
|
55
|
-
name: "Short Cross Over",
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
where: {
|
|
60
|
-
value: "5ML",
|
|
61
|
-
},
|
|
62
|
-
create: {
|
|
63
|
-
value: "5ML",
|
|
64
|
-
name: "5 BF Middle Loop",
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
where: {
|
|
69
|
-
value: "6BF",
|
|
70
|
-
},
|
|
71
|
-
create: {
|
|
72
|
-
value: "6BF",
|
|
73
|
-
name: "6 Blast Furnace",
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
where: {
|
|
78
|
-
value: "DSML",
|
|
79
|
-
},
|
|
80
|
-
create: {
|
|
81
|
-
value: "DSML",
|
|
82
|
-
name: "Desulph Main Line",
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
const create5BFE = await prisma.station.create({
|
|
90
|
-
data: {
|
|
91
|
-
value: "5BFE",
|
|
92
|
-
name: "5 Blast Furnace - East",
|
|
93
|
-
locations: {
|
|
94
|
-
connectOrCreate: [
|
|
95
|
-
{
|
|
96
|
-
where: {
|
|
97
|
-
value: "5BFE",
|
|
98
|
-
},
|
|
99
|
-
create:
|
|
100
|
-
{
|
|
101
|
-
value: "5BFE",
|
|
102
|
-
name: "5 Blast Furnace - East",
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
]
|
|
11
|
+
const createHolding = await prisma.station.create({
|
|
12
|
+
data: {
|
|
13
|
+
value: "HOLDING",
|
|
14
|
+
name: "Holding",
|
|
15
|
+
locations: {
|
|
16
|
+
connectOrCreate: [
|
|
17
|
+
{
|
|
18
|
+
where: {
|
|
19
|
+
value: "WPR",
|
|
20
|
+
},
|
|
21
|
+
create: {
|
|
22
|
+
value: "WPR",
|
|
23
|
+
name: "Woodpecker Repair Lines",
|
|
106
24
|
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
where: {
|
|
29
|
+
value: "5OL",
|
|
30
|
+
},
|
|
31
|
+
create: {
|
|
32
|
+
value: "5OL",
|
|
33
|
+
name: "5 Outside Loop",
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
where: {
|
|
38
|
+
value: "5BF",
|
|
39
|
+
},
|
|
40
|
+
create: {
|
|
41
|
+
value: "5BF",
|
|
42
|
+
name: "5 Blast Furnace",
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
where: {
|
|
47
|
+
value: "OPM",
|
|
48
|
+
},
|
|
49
|
+
create: {
|
|
50
|
+
value: "OPM",
|
|
51
|
+
name: "Old Plug Mill",
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
where: {
|
|
56
|
+
value: "XOVR",
|
|
57
|
+
},
|
|
58
|
+
create: {
|
|
59
|
+
value: "XOVR",
|
|
60
|
+
name: "Short Cross Over",
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
where: {
|
|
65
|
+
value: "5ML",
|
|
66
|
+
},
|
|
67
|
+
create: {
|
|
68
|
+
value: "5ML",
|
|
69
|
+
name: "5 BF Middle Loop",
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
where: {
|
|
74
|
+
value: "6BF",
|
|
75
|
+
},
|
|
76
|
+
create: {
|
|
77
|
+
value: "6BF",
|
|
78
|
+
name: "6 Blast Furnace",
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
where: {
|
|
83
|
+
value: "DSML",
|
|
84
|
+
},
|
|
85
|
+
create: {
|
|
86
|
+
value: "DSML",
|
|
87
|
+
name: "Desulph Main Line",
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
}
|
|
107
92
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
})
|
|
129
|
-
const create5BFW = await prisma.station.create({
|
|
130
|
-
data: {
|
|
131
|
-
value: "5BFW",
|
|
132
|
-
name: "5 Blast Furnace - West",
|
|
133
|
-
locations: {
|
|
134
|
-
connectOrCreate: [
|
|
135
|
-
{
|
|
136
|
-
where: {
|
|
137
|
-
value: "5BFW",
|
|
138
|
-
},
|
|
139
|
-
create: {
|
|
140
|
-
value: "5BFW",
|
|
141
|
-
name: "5 Blast Furnace - West",
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
})
|
|
148
|
-
const createDES1 = await prisma.station.create({
|
|
149
|
-
data: {
|
|
150
|
-
value: "DES1",
|
|
151
|
-
name: "Desulphurisation 1",
|
|
152
|
-
locations: {
|
|
153
|
-
connectOrCreate: [
|
|
154
|
-
{
|
|
155
|
-
where: {
|
|
156
|
-
value: "DES1",
|
|
157
|
-
},
|
|
158
|
-
create: {
|
|
159
|
-
value: "DES1",
|
|
160
|
-
name: "Desulphurisation 1",
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
})
|
|
167
|
-
const createDES2 = await prisma.station.create({
|
|
168
|
-
data: {
|
|
169
|
-
value: "DES2",
|
|
170
|
-
name: "Desulphurisation 2",
|
|
171
|
-
locations: {
|
|
172
|
-
connectOrCreate: [
|
|
173
|
-
{
|
|
174
|
-
where: {
|
|
175
|
-
value: "DES2",
|
|
176
|
-
},
|
|
177
|
-
create: {
|
|
178
|
-
value: "DES2",
|
|
179
|
-
name: "Desulphurisation 2",
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
})
|
|
186
|
-
const create6PIT = await prisma.station.create({
|
|
187
|
-
data: {
|
|
188
|
-
value: "6PIT",
|
|
189
|
-
name: "6 Pit",
|
|
190
|
-
locations: {
|
|
191
|
-
connectOrCreate: [
|
|
192
|
-
{
|
|
193
|
-
where: {
|
|
194
|
-
value: "6PIT",
|
|
195
|
-
},
|
|
196
|
-
create: {
|
|
197
|
-
value: "6PIT",
|
|
198
|
-
name: "6 Pit",
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
})
|
|
205
|
-
const createWB1 = await prisma.station.create({
|
|
206
|
-
data: {
|
|
207
|
-
value: "WB1",
|
|
208
|
-
name: "Weighbridge 1",
|
|
209
|
-
locations: {
|
|
210
|
-
connectOrCreate: [
|
|
211
|
-
{
|
|
212
|
-
where: {
|
|
213
|
-
value: "WB1",
|
|
214
|
-
},
|
|
215
|
-
create: {
|
|
216
|
-
value: "WB1",
|
|
217
|
-
name: "Weighbridge 1",
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
})
|
|
224
|
-
const createWB2 = await prisma.station.create({
|
|
225
|
-
data: {
|
|
226
|
-
value: "WB2",
|
|
227
|
-
name: "Weighbridge 2",
|
|
228
|
-
locations: {
|
|
229
|
-
connectOrCreate: [
|
|
230
|
-
{
|
|
231
|
-
where: {
|
|
232
|
-
value: "WB2",
|
|
233
|
-
},
|
|
234
|
-
create: {
|
|
235
|
-
value: "WB2",
|
|
236
|
-
name: "Weighbridge 2",
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
]
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
})
|
|
243
|
-
const create21D = await prisma.station.create({
|
|
244
|
-
data: {
|
|
245
|
-
value: "21D",
|
|
246
|
-
name: "Dump",
|
|
247
|
-
locations: {
|
|
248
|
-
connectOrCreate: [
|
|
249
|
-
{
|
|
250
|
-
where: {
|
|
251
|
-
value: "21D",
|
|
252
|
-
},
|
|
253
|
-
create: {
|
|
254
|
-
value: "21D",
|
|
255
|
-
name: "Dump",
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
})
|
|
262
|
-
const createWB1H = await prisma.station.create({
|
|
263
|
-
data: {
|
|
264
|
-
value: "WB1H",
|
|
265
|
-
name: "Weighbridge 1 - Holding",
|
|
266
|
-
locations: {
|
|
267
|
-
connectOrCreate: [
|
|
268
|
-
{
|
|
269
|
-
where: {
|
|
270
|
-
value: "WB1H",
|
|
271
|
-
},
|
|
272
|
-
create: {
|
|
273
|
-
value: "WB1H",
|
|
274
|
-
name: "Weighbridge 1 - Holding",
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
]
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
})
|
|
281
|
-
const createWB2H = await prisma.station.create({
|
|
282
|
-
data: {
|
|
283
|
-
value: "WB2H",
|
|
284
|
-
name: "Weighbridge 2 - Holding",
|
|
285
|
-
locations: {
|
|
286
|
-
connectOrCreate: [
|
|
287
|
-
{
|
|
288
|
-
where: {
|
|
289
|
-
value: "WB2H",
|
|
290
|
-
},
|
|
291
|
-
create: {
|
|
292
|
-
value: "WB2H",
|
|
293
|
-
name: "Weighbridge 2 - Holding",
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
]
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
})
|
|
300
|
-
const createGAS = await prisma.station.create({
|
|
301
|
-
data: {
|
|
302
|
-
value: "GAS",
|
|
303
|
-
name: "On Gas",
|
|
304
|
-
locations: {
|
|
305
|
-
connectOrCreate: [
|
|
306
|
-
{
|
|
307
|
-
where: {
|
|
308
|
-
value: "GASL",
|
|
309
|
-
},
|
|
310
|
-
create: {
|
|
311
|
-
value: "GASL",
|
|
312
|
-
name: "Gasline",
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
where: {
|
|
317
|
-
value: "COOL"
|
|
318
|
-
},
|
|
319
|
-
create: {
|
|
320
|
-
value: "COOL",
|
|
321
|
-
name: "Cooling Station",
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
where: {
|
|
326
|
-
value: "5BFHL",
|
|
327
|
-
},
|
|
328
|
-
create: {
|
|
329
|
-
value: "5BFHL",
|
|
330
|
-
name: "No.5 Blast Furnace Heating line",
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
})
|
|
337
|
-
const createOOS = await prisma.station.create({
|
|
338
|
-
data: {
|
|
339
|
-
value: "OOS",
|
|
340
|
-
name: "Out Of Service",
|
|
341
|
-
locations: {
|
|
342
|
-
connectOrCreate: [
|
|
343
|
-
{
|
|
344
|
-
where: {
|
|
345
|
-
value: "GASL",
|
|
346
|
-
},
|
|
347
|
-
create: {
|
|
348
|
-
value: "GASL",
|
|
349
|
-
name: "Gasline",
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
where: {
|
|
354
|
-
value: "COOL"
|
|
355
|
-
},
|
|
356
|
-
create: {
|
|
357
|
-
value: "COOL",
|
|
358
|
-
name: "Cooling Station",
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
where: {
|
|
363
|
-
value: "5BFHL",
|
|
364
|
-
},
|
|
365
|
-
create: {
|
|
366
|
-
value: "5BFHL",
|
|
367
|
-
name: "No.5 Blast Furnace Heating line",
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
where: {
|
|
372
|
-
value: "5FDRY",
|
|
373
|
-
},
|
|
374
|
-
create: {
|
|
375
|
-
value: "5FDRY",
|
|
376
|
-
name: "No.5 position Foundry",
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
where: {
|
|
381
|
-
value: "GUNR",
|
|
382
|
-
},
|
|
383
|
-
create: {
|
|
384
|
-
value: "GUNR",
|
|
385
|
-
name: "Gunning Road",
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
where: {
|
|
390
|
-
value: "AWNR",
|
|
391
|
-
},
|
|
392
|
-
create: {
|
|
393
|
-
value: "AWNR",
|
|
394
|
-
name: "Awning Road",
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
where: {
|
|
399
|
-
value: "REBS",
|
|
400
|
-
},
|
|
401
|
-
create: {
|
|
402
|
-
value: "REBS",
|
|
403
|
-
name: "Rebrick shed",
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
where: {
|
|
408
|
-
value: "LRS1",
|
|
409
|
-
},
|
|
410
|
-
create: {
|
|
411
|
-
value: "LRS1",
|
|
412
|
-
name: "Ladle Repair shop road 1",
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
where: {
|
|
417
|
-
value: "LRS2",
|
|
418
|
-
},
|
|
419
|
-
create: {
|
|
420
|
-
value: "LRS2",
|
|
421
|
-
name: "Ladle Repair shop road 2",
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
where: {
|
|
426
|
-
value: "KLO",
|
|
427
|
-
},
|
|
428
|
-
create: {
|
|
429
|
-
value: "KLO",
|
|
430
|
-
name: "Klondu",
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
]
|
|
93
|
+
})
|
|
94
|
+
const create5BFE = await prisma.station.create({
|
|
95
|
+
data: {
|
|
96
|
+
value: "5BFE",
|
|
97
|
+
name: "5 Blast Furnace - East",
|
|
98
|
+
locations: {
|
|
99
|
+
connectOrCreate: [
|
|
100
|
+
{
|
|
101
|
+
where: {
|
|
102
|
+
value: "5BFE",
|
|
103
|
+
},
|
|
104
|
+
create:
|
|
105
|
+
{
|
|
106
|
+
value: "5BFE",
|
|
107
|
+
name: "5 Blast Furnace - East",
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
}
|
|
434
113
|
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
114
|
+
})
|
|
115
|
+
const create5BFN = await prisma.station.create({
|
|
116
|
+
data: {
|
|
117
|
+
value: "5BFN",
|
|
118
|
+
name: "5 Blast Furnace - North",
|
|
119
|
+
locations: {
|
|
120
|
+
connectOrCreate: [
|
|
121
|
+
{
|
|
122
|
+
where: {
|
|
123
|
+
value: "5BFN",
|
|
124
|
+
},
|
|
125
|
+
create: {
|
|
126
|
+
value: "5BFN",
|
|
127
|
+
name: "5 Blast Furnace - North",
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
const create5BFW = await prisma.station.create({
|
|
135
|
+
data: {
|
|
136
|
+
value: "5BFW",
|
|
137
|
+
name: "5 Blast Furnace - West",
|
|
138
|
+
locations: {
|
|
139
|
+
connectOrCreate: [
|
|
140
|
+
{
|
|
141
|
+
where: {
|
|
142
|
+
value: "5BFW",
|
|
143
|
+
},
|
|
144
|
+
create: {
|
|
145
|
+
value: "5BFW",
|
|
146
|
+
name: "5 Blast Furnace - West",
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
const createDES1 = await prisma.station.create({
|
|
154
|
+
data: {
|
|
155
|
+
value: "DES1",
|
|
156
|
+
name: "Desulphurisation 1",
|
|
157
|
+
locations: {
|
|
158
|
+
connectOrCreate: [
|
|
159
|
+
{
|
|
160
|
+
where: {
|
|
161
|
+
value: "DES1",
|
|
162
|
+
},
|
|
163
|
+
create: {
|
|
164
|
+
value: "DES1",
|
|
165
|
+
name: "Desulphurisation 1",
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
const createDES2 = await prisma.station.create({
|
|
173
|
+
data: {
|
|
174
|
+
value: "DES2",
|
|
175
|
+
name: "Desulphurisation 2",
|
|
176
|
+
locations: {
|
|
177
|
+
connectOrCreate: [
|
|
178
|
+
{
|
|
179
|
+
where: {
|
|
180
|
+
value: "DES2",
|
|
181
|
+
},
|
|
182
|
+
create: {
|
|
183
|
+
value: "DES2",
|
|
184
|
+
name: "Desulphurisation 2",
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
const create6PIT = await prisma.station.create({
|
|
192
|
+
data: {
|
|
193
|
+
value: "6PIT",
|
|
194
|
+
name: "6 Pit",
|
|
195
|
+
locations: {
|
|
196
|
+
connectOrCreate: [
|
|
197
|
+
{
|
|
198
|
+
where: {
|
|
199
|
+
value: "6PIT",
|
|
200
|
+
},
|
|
201
|
+
create: {
|
|
202
|
+
value: "6PIT",
|
|
203
|
+
name: "6 Pit",
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
})
|
|
210
|
+
const createWB1 = await prisma.station.create({
|
|
211
|
+
data: {
|
|
212
|
+
value: "WB1",
|
|
213
|
+
name: "Weighbridge 1",
|
|
214
|
+
locations: {
|
|
215
|
+
connectOrCreate: [
|
|
216
|
+
{
|
|
217
|
+
where: {
|
|
218
|
+
value: "WB1",
|
|
219
|
+
},
|
|
220
|
+
create: {
|
|
221
|
+
value: "WB1",
|
|
222
|
+
name: "Weighbridge 1",
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
})
|
|
229
|
+
const createWB2 = await prisma.station.create({
|
|
230
|
+
data: {
|
|
231
|
+
value: "WB2",
|
|
232
|
+
name: "Weighbridge 2",
|
|
233
|
+
locations: {
|
|
234
|
+
connectOrCreate: [
|
|
235
|
+
{
|
|
236
|
+
where: {
|
|
237
|
+
value: "WB2",
|
|
238
|
+
},
|
|
239
|
+
create: {
|
|
240
|
+
value: "WB2",
|
|
241
|
+
name: "Weighbridge 2",
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
})
|
|
248
|
+
const create21D = await prisma.station.create({
|
|
249
|
+
data: {
|
|
250
|
+
value: "21D",
|
|
251
|
+
name: "Dump",
|
|
252
|
+
locations: {
|
|
253
|
+
connectOrCreate: [
|
|
254
|
+
{
|
|
255
|
+
where: {
|
|
256
|
+
value: "21D",
|
|
257
|
+
},
|
|
258
|
+
create: {
|
|
259
|
+
value: "21D",
|
|
260
|
+
name: "Dump",
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
const createWB1H = await prisma.station.create({
|
|
268
|
+
data: {
|
|
269
|
+
value: "WB1H",
|
|
270
|
+
name: "Weighbridge 1 - Holding",
|
|
271
|
+
locations: {
|
|
272
|
+
connectOrCreate: [
|
|
273
|
+
{
|
|
274
|
+
where: {
|
|
275
|
+
value: "WB1H",
|
|
276
|
+
},
|
|
277
|
+
create: {
|
|
278
|
+
value: "WB1H",
|
|
279
|
+
name: "Weighbridge 1 - Holding",
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
})
|
|
286
|
+
const createWB2H = await prisma.station.create({
|
|
287
|
+
data: {
|
|
288
|
+
value: "WB2H",
|
|
289
|
+
name: "Weighbridge 2 - Holding",
|
|
290
|
+
locations: {
|
|
291
|
+
connectOrCreate: [
|
|
292
|
+
{
|
|
293
|
+
where: {
|
|
294
|
+
value: "WB2H",
|
|
295
|
+
},
|
|
296
|
+
create: {
|
|
297
|
+
value: "WB2H",
|
|
298
|
+
name: "Weighbridge 2 - Holding",
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
})
|
|
305
|
+
const createGAS = await prisma.station.create({
|
|
306
|
+
data: {
|
|
307
|
+
value: "GAS",
|
|
308
|
+
name: "On Gas",
|
|
309
|
+
locations: {
|
|
310
|
+
connectOrCreate: [
|
|
311
|
+
{
|
|
312
|
+
where: {
|
|
313
|
+
value: "GASL",
|
|
314
|
+
},
|
|
315
|
+
create: {
|
|
316
|
+
value: "GASL",
|
|
317
|
+
name: "Gasline",
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
where: {
|
|
322
|
+
value: "COOL"
|
|
323
|
+
},
|
|
324
|
+
create: {
|
|
325
|
+
value: "COOL",
|
|
326
|
+
name: "Cooling Station",
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
where: {
|
|
331
|
+
value: "5BFHL",
|
|
332
|
+
},
|
|
333
|
+
create: {
|
|
334
|
+
value: "5BFHL",
|
|
335
|
+
name: "No.5 Blast Furnace Heating line",
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
})
|
|
342
|
+
const createOOS = await prisma.station.create({
|
|
343
|
+
data: {
|
|
344
|
+
value: "OOS",
|
|
345
|
+
name: "Out Of Service",
|
|
346
|
+
locations: {
|
|
347
|
+
connectOrCreate: [
|
|
348
|
+
{
|
|
349
|
+
where: {
|
|
350
|
+
value: "GASL",
|
|
351
|
+
},
|
|
352
|
+
create: {
|
|
353
|
+
value: "GASL",
|
|
354
|
+
name: "Gasline",
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
where: {
|
|
359
|
+
value: "COOL"
|
|
360
|
+
},
|
|
361
|
+
create: {
|
|
362
|
+
value: "COOL",
|
|
363
|
+
name: "Cooling Station",
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
where: {
|
|
368
|
+
value: "5BFHL",
|
|
369
|
+
},
|
|
370
|
+
create: {
|
|
371
|
+
value: "5BFHL",
|
|
372
|
+
name: "No.5 Blast Furnace Heating line",
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
where: {
|
|
377
|
+
value: "5FDRY",
|
|
378
|
+
},
|
|
379
|
+
create: {
|
|
380
|
+
value: "5FDRY",
|
|
381
|
+
name: "No.5 position Foundry",
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
where: {
|
|
386
|
+
value: "GUNR",
|
|
387
|
+
},
|
|
388
|
+
create: {
|
|
389
|
+
value: "GUNR",
|
|
390
|
+
name: "Gunning Road",
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
where: {
|
|
395
|
+
value: "AWNR",
|
|
396
|
+
},
|
|
397
|
+
create: {
|
|
398
|
+
value: "AWNR",
|
|
399
|
+
name: "Awning Road",
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
where: {
|
|
404
|
+
value: "REBS",
|
|
405
|
+
},
|
|
406
|
+
create: {
|
|
407
|
+
value: "REBS",
|
|
408
|
+
name: "Rebrick shed",
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
where: {
|
|
413
|
+
value: "LRS1",
|
|
414
|
+
},
|
|
415
|
+
create: {
|
|
416
|
+
value: "LRS1",
|
|
417
|
+
name: "Ladle Repair shop road 1",
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
where: {
|
|
422
|
+
value: "LRS2",
|
|
423
|
+
},
|
|
424
|
+
create: {
|
|
425
|
+
value: "LRS2",
|
|
426
|
+
name: "Ladle Repair shop road 2",
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
where: {
|
|
431
|
+
value: "KLO",
|
|
432
|
+
},
|
|
433
|
+
create: {
|
|
434
|
+
value: "KLO",
|
|
435
|
+
name: "Klondu",
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
})
|
|
442
|
+
const createRM = await prisma.station.create({
|
|
443
|
+
data:
|
|
444
|
+
{
|
|
445
|
+
value: "R+M/BREAK",
|
|
446
|
+
name: "R+M / Break",
|
|
447
|
+
locations: {
|
|
448
|
+
connectOrCreate: [
|
|
449
|
+
{
|
|
450
|
+
where: {
|
|
451
|
+
value: "LRS1",
|
|
452
|
+
},
|
|
453
|
+
create: {
|
|
454
|
+
value: "LRS1",
|
|
455
|
+
name: "Ladle Repair shop road 1",
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
where: {
|
|
460
|
+
value: "LRS2",
|
|
461
|
+
},
|
|
462
|
+
create: {
|
|
463
|
+
value: "LRS2",
|
|
464
|
+
name: "Ladle Repair shop road 2",
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
]
|
|
468
|
+
}
|
|
463
469
|
}
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
console.log({
|
|
467
|
-
create21D,
|
|
468
|
-
create5BFE,
|
|
469
|
-
create5BFN,
|
|
470
|
-
create5BFW,
|
|
471
|
-
create6PIT,
|
|
472
|
-
createDES1,
|
|
473
|
-
createDES2,
|
|
474
|
-
createGAS,
|
|
475
|
-
createHolding,
|
|
476
|
-
createOOS,
|
|
477
|
-
createRM,
|
|
478
|
-
createWB1,
|
|
479
|
-
createWB1H,
|
|
480
|
-
createWB2,
|
|
481
|
-
createWB2H
|
|
482
|
-
});
|
|
483
|
-
const torpedoIdList = await prisma.torpedo.findMany({
|
|
484
|
-
select: {
|
|
485
|
-
torpedoId: true,
|
|
486
|
-
},
|
|
487
|
-
});
|
|
470
|
+
});
|
|
488
471
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
472
|
+
console.log({
|
|
473
|
+
create21D,
|
|
474
|
+
create5BFE,
|
|
475
|
+
create5BFN,
|
|
476
|
+
create5BFW,
|
|
477
|
+
create6PIT,
|
|
478
|
+
createDES1,
|
|
479
|
+
createDES2,
|
|
480
|
+
createGAS,
|
|
481
|
+
createHolding,
|
|
482
|
+
createOOS,
|
|
483
|
+
createRM,
|
|
484
|
+
createWB1,
|
|
485
|
+
createWB1H,
|
|
486
|
+
createWB2,
|
|
487
|
+
createWB2H,
|
|
488
|
+
});
|
|
498
489
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
console.log(i)
|
|
503
|
-
const location1 = await prisma.torpedoLocation.create({
|
|
504
|
-
data: {
|
|
505
|
-
stationId: stationList[i].id,
|
|
506
|
-
position: 0,
|
|
507
|
-
torpedoId: randomtorpedoList[2 * i].torpedoId,
|
|
508
|
-
locationId: stationList[i].locations[0].id,
|
|
490
|
+
const torpedoIdList = await prisma.torpedo.findMany({
|
|
491
|
+
select: {
|
|
492
|
+
torpedoId: true,
|
|
509
493
|
},
|
|
510
494
|
});
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
position: 1,
|
|
516
|
-
torpedoId: randomtorpedoList[2 * i + 1].torpedoId,
|
|
517
|
-
locationId: stationList[i].locations[0].id,
|
|
495
|
+
const stationList = await prisma.station.findMany({
|
|
496
|
+
select: {
|
|
497
|
+
id: true,
|
|
498
|
+
locations: true,
|
|
518
499
|
},
|
|
500
|
+
orderBy: {
|
|
501
|
+
id: "asc"
|
|
502
|
+
}
|
|
519
503
|
});
|
|
520
|
-
|
|
504
|
+
|
|
505
|
+
const randomtorpedoList = _.sample(torpedoIdList, stationList.length * 2);
|
|
506
|
+
let locationsArray = [];
|
|
507
|
+
for (let i = 0; i < stationList.length; i++) {
|
|
508
|
+
console.log(i);
|
|
509
|
+
const location1 = await prisma.torpedoLocation.create({
|
|
510
|
+
data: {
|
|
511
|
+
stationId: stationList[i].id,
|
|
512
|
+
position: 0,
|
|
513
|
+
torpedoId: randomtorpedoList[2 * i].torpedoId,
|
|
514
|
+
locationId: stationList[i].locations[0].id,
|
|
515
|
+
},
|
|
516
|
+
});
|
|
517
|
+
locationsArray.push(location1);
|
|
518
|
+
const location2 = await prisma.torpedoLocation.create({
|
|
519
|
+
data: {
|
|
520
|
+
stationId: stationList[i].id,
|
|
521
|
+
position: 1,
|
|
522
|
+
torpedoId: randomtorpedoList[2 * i + 1].torpedoId,
|
|
523
|
+
locationId: stationList[i].locations[0].id,
|
|
524
|
+
},
|
|
525
|
+
});
|
|
526
|
+
locationsArray.push(location2);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
const remainingTorpedoes = torpedoIdList.filter((a) => !randomtorpedoList.some((b) => b.torpedoId === a.torpedoId));
|
|
530
|
+
for (let i: number = 0; i < remainingTorpedoes.length; i++) {
|
|
531
|
+
const randomLocation = await prisma.torpedoLocation.create({
|
|
532
|
+
data: {
|
|
533
|
+
stationId: 1,
|
|
534
|
+
position: 2 + i,
|
|
535
|
+
torpedoId: remainingTorpedoes[i].torpedoId,
|
|
536
|
+
locationId: stationList[0].locations[0].id
|
|
537
|
+
},
|
|
538
|
+
});
|
|
539
|
+
locationsArray.push(randomLocation);
|
|
540
|
+
}
|
|
541
|
+
console.log(locationsArray);
|
|
521
542
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
543
|
+
|
|
544
|
+
// SEED: TorpedoState
|
|
545
|
+
if (await prisma.torpedoState.count() > 0) {
|
|
546
|
+
console.log("SEED: TorpedoState - skipped.");
|
|
547
|
+
} else {
|
|
548
|
+
console.log("SEED: TorpedoState - generating...");
|
|
549
|
+
|
|
550
|
+
const createTorpedoState = await prisma.torpedoState.createMany({
|
|
551
|
+
data: [
|
|
552
|
+
{ name: "OPR", label: "Operational", description: "Carrying metal" },
|
|
553
|
+
{ name: "AVE", label: "Available & Empty", description: "Empty & not in Gas, OOS, LRS" },
|
|
554
|
+
{ name: "SBY", label: "On Gas", description: "Stand by", },
|
|
555
|
+
{ name: "RM", label: "Routine Maintenance", description: "R+M/Break for R+M" },
|
|
556
|
+
{ name: "BR", label: "Breakdown", description: "R+M/Break for Breakdown" },
|
|
557
|
+
{ name: "OOS", label: "Out of service", description: "Out of service" },
|
|
558
|
+
],
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
console.log({
|
|
562
|
+
createTorpedoState,
|
|
531
563
|
});
|
|
532
|
-
locationsArray.push(randomLocation)
|
|
533
564
|
}
|
|
534
|
-
console.log(locationsArray)
|
|
535
565
|
}
|
|
536
566
|
|
|
537
567
|
main()
|
|
@@ -542,4 +572,4 @@ main()
|
|
|
542
572
|
console.error(e)
|
|
543
573
|
await prisma.$disconnect()
|
|
544
574
|
process.exit(1)
|
|
545
|
-
})
|
|
575
|
+
})
|