@juliobrim/prisma-shared 1.0.48 → 1.0.49
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,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `shiftId` on the `break` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `end_time` on the `shift` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `start_time` on the `shift` table. All the data in the column will be lost.
|
|
7
|
+
- You are about to drop the `_OperatorToShift` table. If the table is not empty, all the data it contains will be lost.
|
|
8
|
+
- You are about to drop the `operator_shift` table. If the table is not empty, all the data it contains will be lost.
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
-- DropForeignKey
|
|
12
|
+
ALTER TABLE "_OperatorToShift" DROP CONSTRAINT "_OperatorToShift_A_fkey";
|
|
13
|
+
|
|
14
|
+
-- DropForeignKey
|
|
15
|
+
ALTER TABLE "_OperatorToShift" DROP CONSTRAINT "_OperatorToShift_B_fkey";
|
|
16
|
+
|
|
17
|
+
-- DropForeignKey
|
|
18
|
+
ALTER TABLE "break" DROP CONSTRAINT "break_shiftId_fkey";
|
|
19
|
+
|
|
20
|
+
-- DropForeignKey
|
|
21
|
+
ALTER TABLE "operator_shift" DROP CONSTRAINT "fk_shift";
|
|
22
|
+
|
|
23
|
+
-- DropForeignKey
|
|
24
|
+
ALTER TABLE "operator_shift" DROP CONSTRAINT "operator_shift_operator_id_fkey";
|
|
25
|
+
|
|
26
|
+
-- DropForeignKey
|
|
27
|
+
ALTER TABLE "operator_shift" DROP CONSTRAINT "operator_shift_tenantId_fkey";
|
|
28
|
+
|
|
29
|
+
-- AlterTable
|
|
30
|
+
ALTER TABLE "break" DROP COLUMN "shiftId",
|
|
31
|
+
ADD COLUMN "shiftDayId" TEXT;
|
|
32
|
+
|
|
33
|
+
-- AlterTable
|
|
34
|
+
ALTER TABLE "operator" ADD COLUMN "shiftId" TEXT;
|
|
35
|
+
|
|
36
|
+
-- AlterTable
|
|
37
|
+
ALTER TABLE "shift" DROP COLUMN "end_time",
|
|
38
|
+
DROP COLUMN "start_time";
|
|
39
|
+
|
|
40
|
+
-- DropTable
|
|
41
|
+
DROP TABLE "_OperatorToShift";
|
|
42
|
+
|
|
43
|
+
-- DropTable
|
|
44
|
+
DROP TABLE "operator_shift";
|
|
45
|
+
|
|
46
|
+
-- CreateTable
|
|
47
|
+
CREATE TABLE "shift_day" (
|
|
48
|
+
"id" TEXT NOT NULL,
|
|
49
|
+
"dayOfWeek" INTEGER NOT NULL,
|
|
50
|
+
"isWorkingDay" BOOLEAN NOT NULL DEFAULT true,
|
|
51
|
+
"start_time" TIME(6),
|
|
52
|
+
"end_time" TIME(6),
|
|
53
|
+
"shiftId" TEXT NOT NULL,
|
|
54
|
+
"tenantId" TEXT,
|
|
55
|
+
|
|
56
|
+
CONSTRAINT "shift_day_pkey" PRIMARY KEY ("id")
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
-- CreateIndex
|
|
60
|
+
CREATE UNIQUE INDEX "shift_day_shiftId_dayOfWeek_key" ON "shift_day"("shiftId", "dayOfWeek");
|
|
61
|
+
|
|
62
|
+
-- AddForeignKey
|
|
63
|
+
ALTER TABLE "break" ADD CONSTRAINT "break_shiftDayId_fkey" FOREIGN KEY ("shiftDayId") REFERENCES "shift_day"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
64
|
+
|
|
65
|
+
-- AddForeignKey
|
|
66
|
+
ALTER TABLE "operator" ADD CONSTRAINT "operator_shiftId_fkey" FOREIGN KEY ("shiftId") REFERENCES "shift"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
67
|
+
|
|
68
|
+
-- AddForeignKey
|
|
69
|
+
ALTER TABLE "shift_day" ADD CONSTRAINT "shift_day_shiftId_fkey" FOREIGN KEY ("shiftId") REFERENCES "shift"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
70
|
+
|
|
71
|
+
-- AddForeignKey
|
|
72
|
+
ALTER TABLE "shift_day" ADD CONSTRAINT "shift_day_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -55,11 +55,11 @@ model Tenant {
|
|
|
55
55
|
sectors Sector[]
|
|
56
56
|
sewMachineRawData SewMachineRawData[]
|
|
57
57
|
shifts Shift[]
|
|
58
|
+
shiftDays ShiftDay[]
|
|
58
59
|
systemPreferences SystemPreferences[]
|
|
59
60
|
processingScripts ProcessingScript[]
|
|
60
61
|
users User[]
|
|
61
62
|
userPermissions UserPermission[]
|
|
62
|
-
operatorShifts OperatorShift[]
|
|
63
63
|
machineOperationStitch MachineOperationStitch[]
|
|
64
64
|
productivityIntervals ProductivityIntervalCache[]
|
|
65
65
|
aiConversations AiConversation[]
|
|
@@ -93,13 +93,13 @@ model Account {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
model Break {
|
|
96
|
-
id String
|
|
97
|
-
start_time DateTime
|
|
98
|
-
end_time DateTime
|
|
99
|
-
|
|
96
|
+
id String @id @default(cuid())
|
|
97
|
+
start_time DateTime @db.Time(6)
|
|
98
|
+
end_time DateTime @db.Time(6)
|
|
99
|
+
shiftDayId String?
|
|
100
100
|
tenantId String?
|
|
101
|
-
|
|
102
|
-
tenant Tenant?
|
|
101
|
+
shiftDay ShiftDay? @relation(fields: [shiftDayId], references: [id], onDelete: Cascade)
|
|
102
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
103
103
|
|
|
104
104
|
@@map("break")
|
|
105
105
|
}
|
|
@@ -538,9 +538,9 @@ model Operator {
|
|
|
538
538
|
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
539
539
|
ProductionNode ProductionNode?
|
|
540
540
|
habilityResources Resource[] @relation("OperatorToResource")
|
|
541
|
-
|
|
541
|
+
shiftId String?
|
|
542
|
+
shift Shift? @relation(fields: [shiftId], references: [id])
|
|
542
543
|
productivityIntervals ProductivityIntervalCache[]
|
|
543
|
-
operatorShifts OperatorShift[]
|
|
544
544
|
qualityRegisters QualityRegister[]
|
|
545
545
|
|
|
546
546
|
@@index([tenantId, isDeleted])
|
|
@@ -753,19 +753,32 @@ model SewMachineRawData {
|
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
model Shift {
|
|
756
|
-
id
|
|
757
|
-
name
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
tenantId
|
|
761
|
-
|
|
762
|
-
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
763
|
-
operator_shift OperatorShift[]
|
|
764
|
-
operators Operator[] @relation("OperatorToShift")
|
|
756
|
+
id String @id @default(cuid())
|
|
757
|
+
name String @unique @db.VarChar(100)
|
|
758
|
+
tenantId String?
|
|
759
|
+
days ShiftDay[]
|
|
760
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
761
|
+
operators Operator[]
|
|
765
762
|
|
|
766
763
|
@@map("shift")
|
|
767
764
|
}
|
|
768
765
|
|
|
766
|
+
model ShiftDay {
|
|
767
|
+
id String @id @default(cuid())
|
|
768
|
+
dayOfWeek Int // 0 = Domingo, 1 = Segunda, 2 = Terça, ..., 6 = Sábado
|
|
769
|
+
isWorkingDay Boolean @default(true)
|
|
770
|
+
start_time DateTime? @db.Time(6)
|
|
771
|
+
end_time DateTime? @db.Time(6)
|
|
772
|
+
shiftId String
|
|
773
|
+
shift Shift @relation(fields: [shiftId], references: [id], onDelete: Cascade)
|
|
774
|
+
breaks Break[]
|
|
775
|
+
tenantId String?
|
|
776
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
777
|
+
|
|
778
|
+
@@unique([shiftId, dayOfWeek])
|
|
779
|
+
@@map("shift_day")
|
|
780
|
+
}
|
|
781
|
+
|
|
769
782
|
model SystemPreferences {
|
|
770
783
|
id Int @id @default(autoincrement())
|
|
771
784
|
downtimeEventTime Int @default(300)
|
|
@@ -833,18 +846,6 @@ model UserPermission {
|
|
|
833
846
|
@@map("user_permission")
|
|
834
847
|
}
|
|
835
848
|
|
|
836
|
-
model OperatorShift {
|
|
837
|
-
id Int @id @default(autoincrement())
|
|
838
|
-
operatorId String @map("operator_id")
|
|
839
|
-
shift_id String?
|
|
840
|
-
tenantId String?
|
|
841
|
-
shift Shift? @relation(fields: [shift_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_shift")
|
|
842
|
-
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
843
|
-
operator Operator @relation(fields: [operatorId], references: [id], onDelete: Cascade)
|
|
844
|
-
|
|
845
|
-
@@map("operator_shift")
|
|
846
|
-
}
|
|
847
|
-
|
|
848
849
|
view ProductivityInterval {
|
|
849
850
|
machineId String
|
|
850
851
|
sequenceId Int @map("sequence_id")
|