@juliobrim/prisma-shared 1.0.35 → 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,27 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "public"."machine" ADD COLUMN "processingScriptId" TEXT;
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "public"."processing_script" (
|
|
6
|
+
"id" TEXT NOT NULL,
|
|
7
|
+
"name" TEXT NOT NULL,
|
|
8
|
+
"description" TEXT,
|
|
9
|
+
"script" TEXT NOT NULL,
|
|
10
|
+
"isDefault" BOOLEAN NOT NULL DEFAULT false,
|
|
11
|
+
"tenantId" TEXT,
|
|
12
|
+
"version" INTEGER NOT NULL DEFAULT 1,
|
|
13
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
14
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
15
|
+
"createdBy" TEXT,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "processing_script_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE INDEX "processing_script_tenantId_idx" ON "public"."processing_script"("tenantId");
|
|
22
|
+
|
|
23
|
+
-- AddForeignKey
|
|
24
|
+
ALTER TABLE "public"."machine" ADD CONSTRAINT "machine_processingScriptId_fkey" FOREIGN KEY ("processingScriptId") REFERENCES "public"."processing_script"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
25
|
+
|
|
26
|
+
-- AddForeignKey
|
|
27
|
+
ALTER TABLE "public"."processing_script" ADD CONSTRAINT "processing_script_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "public"."tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -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[]
|
|
@@ -55,9 +55,11 @@ model Tenant {
|
|
|
55
55
|
sewMachineRawData SewMachineRawData[]
|
|
56
56
|
shifts Shift[]
|
|
57
57
|
systemPreferences SystemPreferences[]
|
|
58
|
+
processingScripts ProcessingScript[]
|
|
58
59
|
users User[]
|
|
59
60
|
userPermissions UserPermission[]
|
|
60
61
|
userShifts UserShift[]
|
|
62
|
+
machineOperationStitch MachineOperationStitch[]
|
|
61
63
|
|
|
62
64
|
@@map("tenant")
|
|
63
65
|
}
|
|
@@ -264,12 +266,33 @@ model Machine {
|
|
|
264
266
|
operationRegister OperationRegister[]
|
|
265
267
|
productionNodes ProductionNode?
|
|
266
268
|
operationResources Resource[] @relation("MachineToResource")
|
|
269
|
+
processingScriptId String?
|
|
270
|
+
processingScript ProcessingScript? @relation(fields: [processingScriptId], references: [id])
|
|
267
271
|
MachineProcessingScript MachineProcessingScript?
|
|
268
272
|
MachineScriptState MachineScriptState?
|
|
273
|
+
machineOperationStitch MachineOperationStitch[]
|
|
269
274
|
|
|
270
275
|
@@map("machine")
|
|
271
276
|
}
|
|
272
277
|
|
|
278
|
+
model ProcessingScript {
|
|
279
|
+
id String @id @default(cuid())
|
|
280
|
+
name String
|
|
281
|
+
description String?
|
|
282
|
+
script String
|
|
283
|
+
isDefault Boolean @default(false)
|
|
284
|
+
tenantId String?
|
|
285
|
+
version Int @default(1)
|
|
286
|
+
createdAt DateTime @default(now())
|
|
287
|
+
updatedAt DateTime @updatedAt
|
|
288
|
+
createdBy String?
|
|
289
|
+
machines Machine[]
|
|
290
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
291
|
+
|
|
292
|
+
@@index([tenantId])
|
|
293
|
+
@@map("processing_script")
|
|
294
|
+
}
|
|
295
|
+
|
|
273
296
|
model MachineFormula {
|
|
274
297
|
id String @id @default(cuid())
|
|
275
298
|
machineId String
|
|
@@ -351,37 +374,38 @@ model NotificationToUser {
|
|
|
351
374
|
}
|
|
352
375
|
|
|
353
376
|
model Operation {
|
|
354
|
-
id String
|
|
377
|
+
id String @id @default(cuid())
|
|
355
378
|
stitches Int
|
|
356
379
|
finalIntervalTime Float
|
|
357
380
|
description String
|
|
358
381
|
resourceId String
|
|
359
|
-
timeToProduce Int
|
|
360
|
-
numberOfCuts Int
|
|
361
|
-
nodeId String
|
|
382
|
+
timeToProduce Int @default(10)
|
|
383
|
+
numberOfCuts Int @default(0)
|
|
384
|
+
nodeId String @unique
|
|
362
385
|
nodeIndex Int?
|
|
363
|
-
amount Int
|
|
386
|
+
amount Int @default(1)
|
|
364
387
|
operationId String?
|
|
365
|
-
engineeringTime Int
|
|
366
|
-
initialTime Int
|
|
367
|
-
pcpTime Int
|
|
388
|
+
engineeringTime Int @default(0)
|
|
389
|
+
initialTime Int @default(0)
|
|
390
|
+
pcpTime Int @default(0)
|
|
368
391
|
tenantId String?
|
|
369
392
|
downtimeEvents DowntimeEvent[]
|
|
370
393
|
inputRegisters InputRegister[]
|
|
371
394
|
itemsHandlingRegisters ItemsHandlingRegister[]
|
|
372
395
|
nodeOperationQueue NodeOperationQueue[]
|
|
373
|
-
node Node
|
|
374
|
-
resource Resource
|
|
375
|
-
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)
|
|
376
399
|
operationRegisters OperationRegister[]
|
|
377
|
-
inputOf OperationToOperation[]
|
|
378
|
-
outputOf OperationToOperation[]
|
|
400
|
+
inputOf OperationToOperation[] @relation("inputOperation")
|
|
401
|
+
outputOf OperationToOperation[] @relation("outputOperation")
|
|
379
402
|
products ProductToOperation[]
|
|
380
403
|
productionNodes ProductionNode[]
|
|
381
|
-
operationGroups OperationGroup[]
|
|
404
|
+
operationGroups OperationGroup[] @relation("OperationToOperationGroup")
|
|
382
405
|
// Relações para grupos
|
|
383
|
-
groupMemberships OperationGroupMember[]
|
|
384
|
-
memberOfGroups OperationGroupMember[]
|
|
406
|
+
groupMemberships OperationGroupMember[] @relation("GroupOperations")
|
|
407
|
+
memberOfGroups OperationGroupMember[] @relation("MemberOperations")
|
|
408
|
+
machineOperationStitch MachineOperationStitch[]
|
|
385
409
|
|
|
386
410
|
@@index([nodeId], map: "idx_operation_node_id")
|
|
387
411
|
@@map("operation")
|
|
@@ -955,3 +979,17 @@ enum Colors {
|
|
|
955
979
|
pink
|
|
956
980
|
violet
|
|
957
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
|
+
}
|