@bslau/hmm_prisma_schema 1.5.1 → 1.5.2
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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE [dbo].[EventTorpedoMovement] DROP CONSTRAINT [EventTorpedoMovement_torpedoStateId_df];
|
|
7
|
+
ALTER TABLE [dbo].[EventTorpedoMovement] ALTER COLUMN [torpedoStateId] INT NULL;
|
|
8
|
+
|
|
9
|
+
-- AddForeignKey
|
|
10
|
+
ALTER TABLE [dbo].[EventTorpedoMovement] ADD CONSTRAINT [EventTorpedoMovement_torpedoStateId_fkey] FOREIGN KEY ([torpedoStateId]) REFERENCES [dbo].[TorpedoState]([id]) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
|
11
|
+
|
|
12
|
+
COMMIT TRAN;
|
|
13
|
+
|
|
14
|
+
END TRY
|
|
15
|
+
BEGIN CATCH
|
|
16
|
+
|
|
17
|
+
IF @@TRANCOUNT > 0
|
|
18
|
+
BEGIN
|
|
19
|
+
ROLLBACK TRAN;
|
|
20
|
+
END;
|
|
21
|
+
THROW
|
|
22
|
+
|
|
23
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -101,7 +101,6 @@ model EventTorpedoMovement {
|
|
|
101
101
|
id Int @id @default(autoincrement())
|
|
102
102
|
torpedoId Int
|
|
103
103
|
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId])
|
|
104
|
-
torpedoStateId Int @default(0)
|
|
105
104
|
eventTime DateTime @db.DateTimeOffset
|
|
106
105
|
originStation Station @relation(name: "originStation-movement", fields: [originStationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
107
106
|
originStationId Int
|
|
@@ -118,6 +117,8 @@ model EventTorpedoMovement {
|
|
|
118
117
|
torpedoCycleId Int?
|
|
119
118
|
torpedoTrip TorpedoTrip? @relation(fields: [torpedoTripId], references: [id])
|
|
120
119
|
torpedoTripId Int?
|
|
120
|
+
torpedoState TorpedoState? @relation(fields: [torpedoStateId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
121
|
+
torpedoStateId Int?
|
|
121
122
|
createdAt DateTime @default(now())
|
|
122
123
|
updatedAt DateTime @updatedAt
|
|
123
124
|
}
|
|
@@ -436,11 +437,12 @@ model TorpedoLocation {
|
|
|
436
437
|
///
|
|
437
438
|
/// Describes a valid operational _State_ that a _Torpedo_ can be assigned.
|
|
438
439
|
model TorpedoState {
|
|
439
|
-
id
|
|
440
|
-
name
|
|
441
|
-
label
|
|
442
|
-
description
|
|
443
|
-
torpedoes
|
|
440
|
+
id Int @id @default(autoincrement())
|
|
441
|
+
name String @unique
|
|
442
|
+
label String
|
|
443
|
+
description String
|
|
444
|
+
torpedoes Torpedo[]
|
|
445
|
+
eventsTorpedoMovement EventTorpedoMovement[]
|
|
444
446
|
}
|
|
445
447
|
|
|
446
448
|
/// **TORPEDO TRIP (ON LINING)**
|