@juliobrim/prisma-shared 1.0.47 → 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,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")
|
|
@@ -667,6 +671,7 @@ model ProductionOrder {
|
|
|
667
671
|
operationRegisters OperationRegister[]
|
|
668
672
|
productionNode ProductionNode[]
|
|
669
673
|
productivityIntervals ProductivityIntervalCache[]
|
|
674
|
+
qualityRegisters QualityRegister[]
|
|
670
675
|
flow Flow? @relation(fields: [flowId], references: [id])
|
|
671
676
|
Product Product @relation(fields: [productId], references: [id])
|
|
672
677
|
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
@@ -719,15 +724,16 @@ model Resource {
|
|
|
719
724
|
}
|
|
720
725
|
|
|
721
726
|
model Sector {
|
|
722
|
-
id
|
|
723
|
-
name
|
|
724
|
-
description
|
|
725
|
-
isDeleted
|
|
726
|
-
tenantId
|
|
727
|
-
stationFrom
|
|
728
|
-
stationTo
|
|
729
|
-
machines
|
|
730
|
-
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[]
|
|
731
737
|
|
|
732
738
|
@@map("sector")
|
|
733
739
|
}
|
|
@@ -1128,3 +1134,53 @@ model AiFeedback {
|
|
|
1128
1134
|
|
|
1129
1135
|
@@map("ai_feedback")
|
|
1130
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
|
+
}
|