@juliobrim/prisma-shared 1.0.44 → 1.0.46

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,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "productivity_interval_cache" ADD COLUMN "time_to_produce_history" TEXT;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juliobrim/prisma-shared",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "Schema Prisma compartilhado entre projetos Sabcon",
5
5
  "main": "schema.prisma",
6
6
  "files": [
package/schema.prisma CHANGED
@@ -59,7 +59,7 @@ model Tenant {
59
59
  processingScripts ProcessingScript[]
60
60
  users User[]
61
61
  userPermissions UserPermission[]
62
- userShifts UserShift[]
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")
@@ -745,15 +746,15 @@ model SewMachineRawData {
745
746
  }
746
747
 
747
748
  model Shift {
748
- id String @id @default(cuid())
749
- name String @unique @db.VarChar(100)
750
- start_time DateTime @db.Time(6)
751
- end_time DateTime @db.Time(6)
752
- tenantId String?
753
- breaks Break[]
754
- tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
755
- user_shift UserShift[]
756
- operators Operator[] @relation("OperatorToShift")
749
+ id String @id @default(cuid())
750
+ name String @unique @db.VarChar(100)
751
+ start_time DateTime @db.Time(6)
752
+ end_time DateTime @db.Time(6)
753
+ tenantId String?
754
+ breaks Break[]
755
+ tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
756
+ operator_shift OperatorShift[]
757
+ operators Operator[] @relation("OperatorToShift")
757
758
 
758
759
  @@map("shift")
759
760
  }
@@ -808,7 +809,6 @@ model User {
808
809
  twoFactorConfirmation TwoFactorConfirmation?
809
810
  tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
810
811
  userPermissions UserPermission[]
811
- UserShift UserShift[]
812
812
  aiConversations AiConversation[]
813
813
 
814
814
  @@map("user")
@@ -826,16 +826,16 @@ model UserPermission {
826
826
  @@map("user_permission")
827
827
  }
828
828
 
829
- model UserShift {
830
- id Int @id @default(autoincrement())
831
- userId String @map("user_id")
832
- shift_id String?
833
- tenantId String?
834
- shift Shift? @relation(fields: [shift_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_shift")
835
- tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
836
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
829
+ model OperatorShift {
830
+ id Int @id @default(autoincrement())
831
+ operatorId String @map("operator_id")
832
+ shift_id String?
833
+ tenantId String?
834
+ shift Shift? @relation(fields: [shift_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_shift")
835
+ tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
836
+ operator Operator @relation(fields: [operatorId], references: [id], onDelete: Cascade)
837
837
 
838
- @@map("user_shift")
838
+ @@map("operator_shift")
839
839
  }
840
840
 
841
841
  view ProductivityInterval {
@@ -1062,6 +1062,7 @@ model ProductivityIntervalCache {
1062
1062
  totalDuration Float @map("total_duration")
1063
1063
  efficiencyPercentage Float @map("efficiency_percentage")
1064
1064
  timeToProduceSnapshot Int? @map("time_to_produce_snapshot")
1065
+ timeToProduceHistory String? @map("time_to_produce_history")
1065
1066
  downtimeSeconds Float @default(0) @map("downtime_seconds")
1066
1067
 
1067
1068
  createdAt DateTime @default(now())