@juliobrim/prisma-shared 1.0.53 → 1.0.54
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,22 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "MachineOperationalState" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"machineId" TEXT NOT NULL,
|
|
5
|
+
"countState" JSONB,
|
|
6
|
+
"lastMachineTimestamp" TIMESTAMP(3),
|
|
7
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
8
|
+
|
|
9
|
+
CONSTRAINT "MachineOperationalState_pkey" PRIMARY KEY ("id")
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- CreateIndex
|
|
13
|
+
CREATE UNIQUE INDEX "MachineOperationalState_machineId_key" ON "MachineOperationalState"("machineId");
|
|
14
|
+
|
|
15
|
+
-- CreateIndex
|
|
16
|
+
CREATE INDEX "MachineOperationalState_machineId_idx" ON "MachineOperationalState"("machineId");
|
|
17
|
+
|
|
18
|
+
-- CreateIndex
|
|
19
|
+
CREATE INDEX "MachineOperationalState_lastMachineTimestamp_idx" ON "MachineOperationalState"("lastMachineTimestamp");
|
|
20
|
+
|
|
21
|
+
-- AddForeignKey
|
|
22
|
+
ALTER TABLE "MachineOperationalState" ADD CONSTRAINT "MachineOperationalState_machineId_fkey" FOREIGN KEY ("machineId") REFERENCES "machine"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -284,6 +284,7 @@ model Machine {
|
|
|
284
284
|
MachineScriptState MachineScriptState?
|
|
285
285
|
machineOperationStitch MachineOperationStitch[]
|
|
286
286
|
productivityIntervals ProductivityIntervalCache[]
|
|
287
|
+
machineOperationalState MachineOperationalState?
|
|
287
288
|
|
|
288
289
|
@@unique([tenantId, name])
|
|
289
290
|
@@index([sectorId])
|
|
@@ -909,6 +910,20 @@ model Device {
|
|
|
909
910
|
@@map("device")
|
|
910
911
|
}
|
|
911
912
|
|
|
913
|
+
model MachineOperationalState {
|
|
914
|
+
id String @id @default(cuid())
|
|
915
|
+
machineId String @unique
|
|
916
|
+
countState Json?
|
|
917
|
+
lastMachineTimestamp DateTime?
|
|
918
|
+
updatedAt DateTime @default(now()) @updatedAt
|
|
919
|
+
|
|
920
|
+
machine Machine? @relation(fields: [machineId], references: [id], onDelete: Cascade)
|
|
921
|
+
|
|
922
|
+
@@index([machineId])
|
|
923
|
+
@@index([lastMachineTimestamp])
|
|
924
|
+
@@map("MachineOperationalState")
|
|
925
|
+
}
|
|
926
|
+
|
|
912
927
|
model MachineSensors {
|
|
913
928
|
id String @id @default(cuid())
|
|
914
929
|
machineId String @unique
|