@juliobrim/prisma-shared 1.0.45 → 1.0.47
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.
package/migrations/20260225122857_fix_table_name_from_user_shift_to_operator_shift/migration.sql
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `user_shift` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropForeignKey
|
|
8
|
+
ALTER TABLE "user_shift" DROP CONSTRAINT "fk_shift";
|
|
9
|
+
|
|
10
|
+
-- DropForeignKey
|
|
11
|
+
ALTER TABLE "user_shift" DROP CONSTRAINT "user_shift_tenantId_fkey";
|
|
12
|
+
|
|
13
|
+
-- DropForeignKey
|
|
14
|
+
ALTER TABLE "user_shift" DROP CONSTRAINT "user_shift_user_id_fkey";
|
|
15
|
+
|
|
16
|
+
-- DropTable
|
|
17
|
+
DROP TABLE "user_shift";
|
|
18
|
+
|
|
19
|
+
-- CreateTable
|
|
20
|
+
CREATE TABLE "operator_shift" (
|
|
21
|
+
"id" SERIAL NOT NULL,
|
|
22
|
+
"operator_id" TEXT NOT NULL,
|
|
23
|
+
"shift_id" TEXT,
|
|
24
|
+
"tenantId" TEXT,
|
|
25
|
+
|
|
26
|
+
CONSTRAINT "operator_shift_pkey" PRIMARY KEY ("id")
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
-- AddForeignKey
|
|
30
|
+
ALTER TABLE "operator_shift" ADD CONSTRAINT "fk_shift" FOREIGN KEY ("shift_id") REFERENCES "shift"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
|
|
31
|
+
|
|
32
|
+
-- AddForeignKey
|
|
33
|
+
ALTER TABLE "operator_shift" ADD CONSTRAINT "operator_shift_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
34
|
+
|
|
35
|
+
-- AddForeignKey
|
|
36
|
+
ALTER TABLE "operator_shift" ADD CONSTRAINT "operator_shift_operator_id_fkey" FOREIGN KEY ("operator_id") REFERENCES "operator"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -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;
|
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -59,7 +59,7 @@ model Tenant {
|
|
|
59
59
|
processingScripts ProcessingScript[]
|
|
60
60
|
users User[]
|
|
61
61
|
userPermissions UserPermission[]
|
|
62
|
-
|
|
62
|
+
operatorShifts OperatorShift[]
|
|
63
63
|
machineOperationStitch MachineOperationStitch[]
|
|
64
64
|
productivityIntervals ProductivityIntervalCache[]
|
|
65
65
|
aiConversations AiConversation[]
|
|
@@ -537,6 +537,7 @@ model Operator {
|
|
|
537
537
|
habilityResources Resource[] @relation("OperatorToResource")
|
|
538
538
|
shifts Shift[] @relation("OperatorToShift")
|
|
539
539
|
productivityIntervals ProductivityIntervalCache[]
|
|
540
|
+
operatorShifts OperatorShift[]
|
|
540
541
|
|
|
541
542
|
@@index([tenantId, isDeleted])
|
|
542
543
|
@@map("operator")
|
|
@@ -648,26 +649,27 @@ model ProductionNode {
|
|
|
648
649
|
}
|
|
649
650
|
|
|
650
651
|
model ProductionOrder {
|
|
651
|
-
id String
|
|
652
|
+
id String @id @default(cuid())
|
|
652
653
|
productId String
|
|
653
654
|
flowId String?
|
|
654
|
-
productionOrderIndex Int?
|
|
655
|
+
productionOrderIndex Int? @unique
|
|
655
656
|
batchSize Float
|
|
656
|
-
hasStarted Boolean
|
|
657
|
-
isRunning Boolean
|
|
658
|
-
isFinished Boolean
|
|
657
|
+
hasStarted Boolean @default(false)
|
|
658
|
+
isRunning Boolean @default(false)
|
|
659
|
+
isFinished Boolean @default(false)
|
|
659
660
|
tenantId String?
|
|
660
|
-
endDate DateTime?
|
|
661
|
-
expectedEndDate DateTime?
|
|
662
|
-
startDate DateTime?
|
|
661
|
+
endDate DateTime? @db.Date
|
|
662
|
+
expectedEndDate DateTime? @db.Date
|
|
663
|
+
startDate DateTime? @db.Date
|
|
663
664
|
inputRegisters InputRegister[]
|
|
664
665
|
ItemsHandlingRegister ItemsHandlingRegister[]
|
|
665
666
|
NodeOperationQueue NodeOperationQueue[]
|
|
666
667
|
operationRegisters OperationRegister[]
|
|
667
668
|
productionNode ProductionNode[]
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
669
|
+
productivityIntervals ProductivityIntervalCache[]
|
|
670
|
+
flow Flow? @relation(fields: [flowId], references: [id])
|
|
671
|
+
Product Product @relation(fields: [productId], references: [id])
|
|
672
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
671
673
|
|
|
672
674
|
@@index([tenantId, isFinished])
|
|
673
675
|
@@index([productId])
|
|
@@ -745,15 +747,15 @@ model SewMachineRawData {
|
|
|
745
747
|
}
|
|
746
748
|
|
|
747
749
|
model Shift {
|
|
748
|
-
id
|
|
749
|
-
name
|
|
750
|
-
start_time
|
|
751
|
-
end_time
|
|
752
|
-
tenantId
|
|
753
|
-
breaks
|
|
754
|
-
tenant
|
|
755
|
-
|
|
756
|
-
operators
|
|
750
|
+
id String @id @default(cuid())
|
|
751
|
+
name String @unique @db.VarChar(100)
|
|
752
|
+
start_time DateTime @db.Time(6)
|
|
753
|
+
end_time DateTime @db.Time(6)
|
|
754
|
+
tenantId String?
|
|
755
|
+
breaks Break[]
|
|
756
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
757
|
+
operator_shift OperatorShift[]
|
|
758
|
+
operators Operator[] @relation("OperatorToShift")
|
|
757
759
|
|
|
758
760
|
@@map("shift")
|
|
759
761
|
}
|
|
@@ -808,7 +810,6 @@ model User {
|
|
|
808
810
|
twoFactorConfirmation TwoFactorConfirmation?
|
|
809
811
|
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
810
812
|
userPermissions UserPermission[]
|
|
811
|
-
UserShift UserShift[]
|
|
812
813
|
aiConversations AiConversation[]
|
|
813
814
|
|
|
814
815
|
@@map("user")
|
|
@@ -826,16 +827,16 @@ model UserPermission {
|
|
|
826
827
|
@@map("user_permission")
|
|
827
828
|
}
|
|
828
829
|
|
|
829
|
-
model
|
|
830
|
-
id
|
|
831
|
-
|
|
832
|
-
shift_id
|
|
833
|
-
tenantId
|
|
834
|
-
shift
|
|
835
|
-
tenant
|
|
836
|
-
|
|
830
|
+
model OperatorShift {
|
|
831
|
+
id Int @id @default(autoincrement())
|
|
832
|
+
operatorId String @map("operator_id")
|
|
833
|
+
shift_id String?
|
|
834
|
+
tenantId String?
|
|
835
|
+
shift Shift? @relation(fields: [shift_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_shift")
|
|
836
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
837
|
+
operator Operator @relation(fields: [operatorId], references: [id], onDelete: Cascade)
|
|
837
838
|
|
|
838
|
-
@@map("
|
|
839
|
+
@@map("operator_shift")
|
|
839
840
|
}
|
|
840
841
|
|
|
841
842
|
view ProductivityInterval {
|
|
@@ -1048,11 +1049,13 @@ model MachineOperationStitch {
|
|
|
1048
1049
|
}
|
|
1049
1050
|
|
|
1050
1051
|
model ProductivityIntervalCache {
|
|
1051
|
-
id
|
|
1052
|
-
tenantId
|
|
1053
|
-
machineId
|
|
1054
|
-
operatorId
|
|
1055
|
-
operationId
|
|
1052
|
+
id String @id @default(cuid())
|
|
1053
|
+
tenantId String?
|
|
1054
|
+
machineId String
|
|
1055
|
+
operatorId String
|
|
1056
|
+
operationId String?
|
|
1057
|
+
productionOrderId String?
|
|
1058
|
+
|
|
1056
1059
|
sequenceId Int @map("sequence_id")
|
|
1057
1060
|
groupStartTimestamp DateTime @map("group_start_timestamp")
|
|
1058
1061
|
groupEndTimestamp DateTime @map("group_end_timestamp")
|
|
@@ -1067,10 +1070,11 @@ model ProductivityIntervalCache {
|
|
|
1067
1070
|
|
|
1068
1071
|
createdAt DateTime @default(now())
|
|
1069
1072
|
|
|
1070
|
-
tenant
|
|
1071
|
-
machine
|
|
1072
|
-
operator
|
|
1073
|
-
operation
|
|
1073
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1074
|
+
machine Machine @relation(fields: [machineId], references: [id], onDelete: Cascade)
|
|
1075
|
+
operator Operator @relation(fields: [operatorId], references: [id], onDelete: Cascade)
|
|
1076
|
+
operation Operation? @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
|
1077
|
+
productionOrder ProductionOrder? @relation(fields: [productionOrderId], references: [id], onDelete: Cascade)
|
|
1074
1078
|
|
|
1075
1079
|
@@unique([machineId, groupStartTimestamp])
|
|
1076
1080
|
@@index([tenantId, machineId, groupStartTimestamp])
|