@juliobrim/prisma-shared 1.0.46 → 1.0.48
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,5 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "productivity_interval_cache" ADD COLUMN "productionOrderId" TEXT;
|
|
3
|
+
|
|
4
|
+
-- AddForeignKey
|
|
5
|
+
ALTER TABLE "productivity_interval_cache" ADD CONSTRAINT "productivity_interval_cache_productionOrderId_fkey" FOREIGN KEY ("productionOrderId") REFERENCES "production_order"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "QualityIssueCategory" AS ENUM ('HUMAN_ERROR', 'RAW_MATERIAL', 'MACHINE_FAILURE', 'PROCESS_DEVIATION', 'OTHER');
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "quality_register" (
|
|
6
|
+
"id" TEXT NOT NULL,
|
|
7
|
+
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
8
|
+
"operationId" TEXT NOT NULL,
|
|
9
|
+
"productionOrderId" TEXT,
|
|
10
|
+
"operatorId" TEXT,
|
|
11
|
+
"sectorId" TEXT,
|
|
12
|
+
"qualityIssueId" TEXT,
|
|
13
|
+
"amount" INTEGER NOT NULL DEFAULT 1,
|
|
14
|
+
"comments" TEXT,
|
|
15
|
+
"tenantId" TEXT,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "quality_register_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateTable
|
|
21
|
+
CREATE TABLE "quality_issue" (
|
|
22
|
+
"id" TEXT NOT NULL,
|
|
23
|
+
"name" TEXT NOT NULL,
|
|
24
|
+
"description" TEXT,
|
|
25
|
+
"category" "QualityIssueCategory" NOT NULL DEFAULT 'OTHER',
|
|
26
|
+
"isDeleted" BOOLEAN NOT NULL DEFAULT false,
|
|
27
|
+
"tenantId" TEXT,
|
|
28
|
+
|
|
29
|
+
CONSTRAINT "quality_issue_pkey" PRIMARY KEY ("id")
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
-- CreateIndex
|
|
33
|
+
CREATE INDEX "quality_register_tenantId_idx" ON "quality_register"("tenantId");
|
|
34
|
+
|
|
35
|
+
-- CreateIndex
|
|
36
|
+
CREATE INDEX "quality_register_operationId_idx" ON "quality_register"("operationId");
|
|
37
|
+
|
|
38
|
+
-- CreateIndex
|
|
39
|
+
CREATE INDEX "quality_register_productionOrderId_idx" ON "quality_register"("productionOrderId");
|
|
40
|
+
|
|
41
|
+
-- CreateIndex
|
|
42
|
+
CREATE INDEX "quality_register_operatorId_idx" ON "quality_register"("operatorId");
|
|
43
|
+
|
|
44
|
+
-- CreateIndex
|
|
45
|
+
CREATE INDEX "quality_register_timestamp_idx" ON "quality_register"("timestamp");
|
|
46
|
+
|
|
47
|
+
-- CreateIndex
|
|
48
|
+
CREATE INDEX "quality_issue_tenantId_idx" ON "quality_issue"("tenantId");
|
|
49
|
+
|
|
50
|
+
-- AddForeignKey
|
|
51
|
+
ALTER TABLE "quality_register" ADD CONSTRAINT "quality_register_operationId_fkey" FOREIGN KEY ("operationId") REFERENCES "operation"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
52
|
+
|
|
53
|
+
-- AddForeignKey
|
|
54
|
+
ALTER TABLE "quality_register" ADD CONSTRAINT "quality_register_productionOrderId_fkey" FOREIGN KEY ("productionOrderId") REFERENCES "production_order"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
55
|
+
|
|
56
|
+
-- AddForeignKey
|
|
57
|
+
ALTER TABLE "quality_register" ADD CONSTRAINT "quality_register_operatorId_fkey" FOREIGN KEY ("operatorId") REFERENCES "operator"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
58
|
+
|
|
59
|
+
-- AddForeignKey
|
|
60
|
+
ALTER TABLE "quality_register" ADD CONSTRAINT "quality_register_sectorId_fkey" FOREIGN KEY ("sectorId") REFERENCES "sector"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
61
|
+
|
|
62
|
+
-- AddForeignKey
|
|
63
|
+
ALTER TABLE "quality_register" ADD CONSTRAINT "quality_register_qualityIssueId_fkey" FOREIGN KEY ("qualityIssueId") REFERENCES "quality_issue"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
64
|
+
|
|
65
|
+
-- AddForeignKey
|
|
66
|
+
ALTER TABLE "quality_register" ADD CONSTRAINT "quality_register_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
67
|
+
|
|
68
|
+
-- AddForeignKey
|
|
69
|
+
ALTER TABLE "quality_issue" ADD CONSTRAINT "quality_issue_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -63,6 +63,8 @@ model Tenant {
|
|
|
63
63
|
machineOperationStitch MachineOperationStitch[]
|
|
64
64
|
productivityIntervals ProductivityIntervalCache[]
|
|
65
65
|
aiConversations AiConversation[]
|
|
66
|
+
qualityRegisters QualityRegister[]
|
|
67
|
+
qualityIssues QualityIssue[]
|
|
66
68
|
|
|
67
69
|
@@map("tenant")
|
|
68
70
|
}
|
|
@@ -426,6 +428,7 @@ model Operation {
|
|
|
426
428
|
memberOfGroups OperationGroupMember[] @relation("MemberOperations")
|
|
427
429
|
machineOperationStitch MachineOperationStitch[]
|
|
428
430
|
productivityIntervals ProductivityIntervalCache[]
|
|
431
|
+
qualityRegisters QualityRegister[]
|
|
429
432
|
|
|
430
433
|
@@index([nodeId], map: "idx_operation_node_id")
|
|
431
434
|
@@map("operation")
|
|
@@ -538,6 +541,7 @@ model Operator {
|
|
|
538
541
|
shifts Shift[] @relation("OperatorToShift")
|
|
539
542
|
productivityIntervals ProductivityIntervalCache[]
|
|
540
543
|
operatorShifts OperatorShift[]
|
|
544
|
+
qualityRegisters QualityRegister[]
|
|
541
545
|
|
|
542
546
|
@@index([tenantId, isDeleted])
|
|
543
547
|
@@map("operator")
|
|
@@ -649,26 +653,28 @@ model ProductionNode {
|
|
|
649
653
|
}
|
|
650
654
|
|
|
651
655
|
model ProductionOrder {
|
|
652
|
-
id String
|
|
656
|
+
id String @id @default(cuid())
|
|
653
657
|
productId String
|
|
654
658
|
flowId String?
|
|
655
|
-
productionOrderIndex Int?
|
|
659
|
+
productionOrderIndex Int? @unique
|
|
656
660
|
batchSize Float
|
|
657
|
-
hasStarted Boolean
|
|
658
|
-
isRunning Boolean
|
|
659
|
-
isFinished Boolean
|
|
661
|
+
hasStarted Boolean @default(false)
|
|
662
|
+
isRunning Boolean @default(false)
|
|
663
|
+
isFinished Boolean @default(false)
|
|
660
664
|
tenantId String?
|
|
661
|
-
endDate DateTime?
|
|
662
|
-
expectedEndDate DateTime?
|
|
663
|
-
startDate DateTime?
|
|
665
|
+
endDate DateTime? @db.Date
|
|
666
|
+
expectedEndDate DateTime? @db.Date
|
|
667
|
+
startDate DateTime? @db.Date
|
|
664
668
|
inputRegisters InputRegister[]
|
|
665
669
|
ItemsHandlingRegister ItemsHandlingRegister[]
|
|
666
670
|
NodeOperationQueue NodeOperationQueue[]
|
|
667
671
|
operationRegisters OperationRegister[]
|
|
668
672
|
productionNode ProductionNode[]
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
673
|
+
productivityIntervals ProductivityIntervalCache[]
|
|
674
|
+
qualityRegisters QualityRegister[]
|
|
675
|
+
flow Flow? @relation(fields: [flowId], references: [id])
|
|
676
|
+
Product Product @relation(fields: [productId], references: [id])
|
|
677
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
672
678
|
|
|
673
679
|
@@index([tenantId, isFinished])
|
|
674
680
|
@@index([productId])
|
|
@@ -718,15 +724,16 @@ model Resource {
|
|
|
718
724
|
}
|
|
719
725
|
|
|
720
726
|
model Sector {
|
|
721
|
-
id
|
|
722
|
-
name
|
|
723
|
-
description
|
|
724
|
-
isDeleted
|
|
725
|
-
tenantId
|
|
726
|
-
stationFrom
|
|
727
|
-
stationTo
|
|
728
|
-
machines
|
|
729
|
-
tenant
|
|
727
|
+
id String @id @default(cuid())
|
|
728
|
+
name String @unique @db.VarChar(100)
|
|
729
|
+
description String? @db.VarChar(255)
|
|
730
|
+
isDeleted Boolean @default(false)
|
|
731
|
+
tenantId String?
|
|
732
|
+
stationFrom ItemsHandlingRegister[] @relation("sectorFrom")
|
|
733
|
+
stationTo ItemsHandlingRegister[] @relation("sectorTo")
|
|
734
|
+
machines Machine[]
|
|
735
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
736
|
+
qualityRegisters QualityRegister[]
|
|
730
737
|
|
|
731
738
|
@@map("sector")
|
|
732
739
|
}
|
|
@@ -1048,11 +1055,13 @@ model MachineOperationStitch {
|
|
|
1048
1055
|
}
|
|
1049
1056
|
|
|
1050
1057
|
model ProductivityIntervalCache {
|
|
1051
|
-
id
|
|
1052
|
-
tenantId
|
|
1053
|
-
machineId
|
|
1054
|
-
operatorId
|
|
1055
|
-
operationId
|
|
1058
|
+
id String @id @default(cuid())
|
|
1059
|
+
tenantId String?
|
|
1060
|
+
machineId String
|
|
1061
|
+
operatorId String
|
|
1062
|
+
operationId String?
|
|
1063
|
+
productionOrderId String?
|
|
1064
|
+
|
|
1056
1065
|
sequenceId Int @map("sequence_id")
|
|
1057
1066
|
groupStartTimestamp DateTime @map("group_start_timestamp")
|
|
1058
1067
|
groupEndTimestamp DateTime @map("group_end_timestamp")
|
|
@@ -1067,10 +1076,11 @@ model ProductivityIntervalCache {
|
|
|
1067
1076
|
|
|
1068
1077
|
createdAt DateTime @default(now())
|
|
1069
1078
|
|
|
1070
|
-
tenant
|
|
1071
|
-
machine
|
|
1072
|
-
operator
|
|
1073
|
-
operation
|
|
1079
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1080
|
+
machine Machine @relation(fields: [machineId], references: [id], onDelete: Cascade)
|
|
1081
|
+
operator Operator @relation(fields: [operatorId], references: [id], onDelete: Cascade)
|
|
1082
|
+
operation Operation? @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
|
1083
|
+
productionOrder ProductionOrder? @relation(fields: [productionOrderId], references: [id], onDelete: Cascade)
|
|
1074
1084
|
|
|
1075
1085
|
@@unique([machineId, groupStartTimestamp])
|
|
1076
1086
|
@@index([tenantId, machineId, groupStartTimestamp])
|
|
@@ -1124,3 +1134,53 @@ model AiFeedback {
|
|
|
1124
1134
|
|
|
1125
1135
|
@@map("ai_feedback")
|
|
1126
1136
|
}
|
|
1137
|
+
|
|
1138
|
+
model QualityRegister {
|
|
1139
|
+
id String @id @default(cuid())
|
|
1140
|
+
timestamp DateTime @default(now())
|
|
1141
|
+
operationId String
|
|
1142
|
+
productionOrderId String?
|
|
1143
|
+
operatorId String?
|
|
1144
|
+
sectorId String?
|
|
1145
|
+
qualityIssueId String?
|
|
1146
|
+
amount Int @default(1)
|
|
1147
|
+
comments String?
|
|
1148
|
+
tenantId String?
|
|
1149
|
+
|
|
1150
|
+
operation Operation @relation(fields: [operationId], references: [id])
|
|
1151
|
+
productionOrder ProductionOrder? @relation(fields: [productionOrderId], references: [id])
|
|
1152
|
+
operator Operator? @relation(fields: [operatorId], references: [id])
|
|
1153
|
+
sector Sector? @relation(fields: [sectorId], references: [id])
|
|
1154
|
+
qualityIssue QualityIssue? @relation(fields: [qualityIssueId], references: [id])
|
|
1155
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1156
|
+
|
|
1157
|
+
@@index([tenantId])
|
|
1158
|
+
@@index([operationId])
|
|
1159
|
+
@@index([productionOrderId])
|
|
1160
|
+
@@index([operatorId])
|
|
1161
|
+
@@index([timestamp])
|
|
1162
|
+
@@map("quality_register")
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
model QualityIssue {
|
|
1166
|
+
id String @id @default(cuid())
|
|
1167
|
+
name String
|
|
1168
|
+
description String?
|
|
1169
|
+
category QualityIssueCategory @default(OTHER)
|
|
1170
|
+
isDeleted Boolean @default(false)
|
|
1171
|
+
tenantId String?
|
|
1172
|
+
|
|
1173
|
+
qualityRegisters QualityRegister[]
|
|
1174
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1175
|
+
|
|
1176
|
+
@@index([tenantId])
|
|
1177
|
+
@@map("quality_issue")
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
enum QualityIssueCategory {
|
|
1181
|
+
HUMAN_ERROR
|
|
1182
|
+
RAW_MATERIAL
|
|
1183
|
+
MACHINE_FAILURE
|
|
1184
|
+
PROCESS_DEVIATION
|
|
1185
|
+
OTHER
|
|
1186
|
+
}
|