@juliobrim/prisma-shared 1.0.40 → 1.0.41
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,18 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "public"."machine_operation_stitch" (
|
|
3
|
+
"machineId" TEXT NOT NULL,
|
|
4
|
+
"operationId" TEXT NOT NULL,
|
|
5
|
+
"stitches" INTEGER NOT NULL,
|
|
6
|
+
"tenantId" TEXT,
|
|
7
|
+
|
|
8
|
+
CONSTRAINT "machine_operation_stitch_pkey" PRIMARY KEY ("machineId","operationId")
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
-- AddForeignKey
|
|
12
|
+
ALTER TABLE "public"."machine_operation_stitch" ADD CONSTRAINT "machine_operation_stitch_machineId_fkey" FOREIGN KEY ("machineId") REFERENCES "public"."machine"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
13
|
+
|
|
14
|
+
-- AddForeignKey
|
|
15
|
+
ALTER TABLE "public"."machine_operation_stitch" ADD CONSTRAINT "machine_operation_stitch_operationId_fkey" FOREIGN KEY ("operationId") REFERENCES "public"."operation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "public"."machine_operation_stitch" ADD CONSTRAINT "machine_operation_stitch_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "public"."tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -8,13 +8,13 @@ datasource db {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
model Tenant {
|
|
11
|
-
id String
|
|
12
|
-
name String
|
|
13
|
-
slug String
|
|
14
|
-
domain String?
|
|
15
|
-
isActive Boolean
|
|
16
|
-
createdAt DateTime
|
|
17
|
-
updatedAt DateTime
|
|
11
|
+
id String @id @default(cuid())
|
|
12
|
+
name String @unique
|
|
13
|
+
slug String @unique
|
|
14
|
+
domain String? @unique
|
|
15
|
+
isActive Boolean @default(true)
|
|
16
|
+
createdAt DateTime @default(now())
|
|
17
|
+
updatedAt DateTime @updatedAt
|
|
18
18
|
accounts Account[]
|
|
19
19
|
breaks Break[]
|
|
20
20
|
devices Device[]
|
|
@@ -59,6 +59,7 @@ model Tenant {
|
|
|
59
59
|
users User[]
|
|
60
60
|
userPermissions UserPermission[]
|
|
61
61
|
userShifts UserShift[]
|
|
62
|
+
machineOperationStitch MachineOperationStitch[]
|
|
62
63
|
|
|
63
64
|
@@map("tenant")
|
|
64
65
|
}
|
|
@@ -269,6 +270,7 @@ model Machine {
|
|
|
269
270
|
processingScript ProcessingScript? @relation(fields: [processingScriptId], references: [id])
|
|
270
271
|
MachineProcessingScript MachineProcessingScript?
|
|
271
272
|
MachineScriptState MachineScriptState?
|
|
273
|
+
machineOperationStitch MachineOperationStitch[]
|
|
272
274
|
|
|
273
275
|
@@map("machine")
|
|
274
276
|
}
|
|
@@ -372,37 +374,38 @@ model NotificationToUser {
|
|
|
372
374
|
}
|
|
373
375
|
|
|
374
376
|
model Operation {
|
|
375
|
-
id String
|
|
377
|
+
id String @id @default(cuid())
|
|
376
378
|
stitches Int
|
|
377
379
|
finalIntervalTime Float
|
|
378
380
|
description String
|
|
379
381
|
resourceId String
|
|
380
|
-
timeToProduce Int
|
|
381
|
-
numberOfCuts Int
|
|
382
|
-
nodeId String
|
|
382
|
+
timeToProduce Int @default(10)
|
|
383
|
+
numberOfCuts Int @default(0)
|
|
384
|
+
nodeId String @unique
|
|
383
385
|
nodeIndex Int?
|
|
384
|
-
amount Int
|
|
386
|
+
amount Int @default(1)
|
|
385
387
|
operationId String?
|
|
386
|
-
engineeringTime Int
|
|
387
|
-
initialTime Int
|
|
388
|
-
pcpTime Int
|
|
388
|
+
engineeringTime Int @default(0)
|
|
389
|
+
initialTime Int @default(0)
|
|
390
|
+
pcpTime Int @default(0)
|
|
389
391
|
tenantId String?
|
|
390
392
|
downtimeEvents DowntimeEvent[]
|
|
391
393
|
inputRegisters InputRegister[]
|
|
392
394
|
itemsHandlingRegisters ItemsHandlingRegister[]
|
|
393
395
|
nodeOperationQueue NodeOperationQueue[]
|
|
394
|
-
node Node
|
|
395
|
-
resource Resource
|
|
396
|
-
tenant Tenant?
|
|
396
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
397
|
+
resource Resource @relation(fields: [resourceId], references: [id])
|
|
398
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
397
399
|
operationRegisters OperationRegister[]
|
|
398
|
-
inputOf OperationToOperation[]
|
|
399
|
-
outputOf OperationToOperation[]
|
|
400
|
+
inputOf OperationToOperation[] @relation("inputOperation")
|
|
401
|
+
outputOf OperationToOperation[] @relation("outputOperation")
|
|
400
402
|
products ProductToOperation[]
|
|
401
403
|
productionNodes ProductionNode[]
|
|
402
|
-
operationGroups OperationGroup[]
|
|
404
|
+
operationGroups OperationGroup[] @relation("OperationToOperationGroup")
|
|
403
405
|
// Relações para grupos
|
|
404
|
-
groupMemberships OperationGroupMember[]
|
|
405
|
-
memberOfGroups OperationGroupMember[]
|
|
406
|
+
groupMemberships OperationGroupMember[] @relation("GroupOperations")
|
|
407
|
+
memberOfGroups OperationGroupMember[] @relation("MemberOperations")
|
|
408
|
+
machineOperationStitch MachineOperationStitch[]
|
|
406
409
|
|
|
407
410
|
@@index([nodeId], map: "idx_operation_node_id")
|
|
408
411
|
@@map("operation")
|
|
@@ -976,3 +979,17 @@ enum Colors {
|
|
|
976
979
|
pink
|
|
977
980
|
violet
|
|
978
981
|
}
|
|
982
|
+
|
|
983
|
+
model MachineOperationStitch {
|
|
984
|
+
machineId String
|
|
985
|
+
operationId String
|
|
986
|
+
stitches Int
|
|
987
|
+
tenantId String?
|
|
988
|
+
|
|
989
|
+
machine Machine @relation(fields: [machineId], references: [id], onDelete: Cascade)
|
|
990
|
+
operation Operation @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
|
991
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
992
|
+
|
|
993
|
+
@@id([machineId, operationId])
|
|
994
|
+
@@map("machine_operation_stitch")
|
|
995
|
+
}
|