@juliobrim/prisma-shared 1.0.30 → 1.0.32

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,14 @@
1
+ -- CreateIndex
2
+ CREATE INDEX "downtime_event_operatorId_end_time_elapsedTime_idx" ON "public"."downtime_event"("operatorId", "end_time", "elapsedTime");
3
+
4
+ -- CreateIndex
5
+ CREATE INDEX "downtime_event_tenantId_operatorId_end_time_idx" ON "public"."downtime_event"("tenantId", "operatorId", "end_time");
6
+
7
+ -- CreateIndex
8
+ CREATE INDEX "operation_register_operatorId_endTime_elapsedTime_idx" ON "public"."operation_register"("operatorId", "endTime", "elapsedTime");
9
+
10
+ -- CreateIndex
11
+ CREATE INDEX "operation_register_tenantId_operatorId_endTime_idx" ON "public"."operation_register"("tenantId", "operatorId", "endTime");
12
+
13
+ -- CreateIndex
14
+ CREATE INDEX "operator_tenantId_isDeleted_idx" ON "public"."operator"("tenantId", "isDeleted");
@@ -0,0 +1,19 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - The primary key for the `product_batch` table will be changed. If it partially fails, the table could be left without primary key constraint.
5
+ - You are about to drop the column `quantity` on the `product_batch` table. All the data in the column will be lost.
6
+ - The `id` column on the `product_batch` table would be dropped and recreated. This will lead to data loss if there is data in the column.
7
+ - Added the required column `currentQuantity` to the `product_batch` table without a default value. This is not possible if the table is not empty.
8
+ - Added the required column `initialQuantity` to the `product_batch` table without a default value. This is not possible if the table is not empty.
9
+
10
+ */
11
+ -- AlterTable
12
+ ALTER TABLE "public"."product_batch" DROP CONSTRAINT "product_batch_pkey",
13
+ DROP COLUMN "quantity",
14
+ ADD COLUMN "currentQuantity" DOUBLE PRECISION NOT NULL,
15
+ ADD COLUMN "initialQuantity" DOUBLE PRECISION NOT NULL,
16
+ ADD COLUMN "internalBatchNumber" TEXT,
17
+ DROP COLUMN "id",
18
+ ADD COLUMN "id" SERIAL NOT NULL,
19
+ ADD CONSTRAINT "product_batch_pkey" PRIMARY KEY ("id");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juliobrim/prisma-shared",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Schema Prisma compartilhado entre projetos Sabcon",
5
5
  "main": "schema.prisma",
6
6
  "files": [
package/schema.prisma CHANGED
@@ -116,6 +116,8 @@ model DowntimeEvent {
116
116
  operator Operator? @relation(fields: [operatorId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_operator")
117
117
  Notification Notification[]
118
118
 
119
+ @@index([operatorId, end_time, elapsedTime])
120
+ @@index([tenantId, operatorId, end_time])
119
121
  @@map("downtime_event")
120
122
  }
121
123
 
@@ -423,6 +425,8 @@ model OperationRegister {
423
425
  productionOrder ProductionOrder @relation(fields: [productionOrderId], references: [id])
424
426
  tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
425
427
 
428
+ @@index([operatorId, endTime, elapsedTime])
429
+ @@index([tenantId, operatorId, endTime])
426
430
  @@map("operation_register")
427
431
  }
428
432
 
@@ -460,6 +464,7 @@ model Operator {
460
464
  habilityResources Resource[] @relation("OperatorToResource")
461
465
  shifts Shift[] @relation("OperatorToShift")
462
466
 
467
+ @@index([tenantId, isDeleted])
463
468
  @@map("operator")
464
469
  }
465
470
 
@@ -874,16 +879,18 @@ model DeviceOperator {
874
879
  }
875
880
 
876
881
  model ProductBatch {
877
- id String @id @default(cuid())
878
- productId String
879
- batchNumber String
880
- quantity Float
881
- expiryDate DateTime @db.Date
882
- createdAt DateTime @default(now())
883
- updatedAt DateTime @updatedAt
884
- tenantId String?
885
- product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
886
- tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
882
+ id Int @id @default(autoincrement())
883
+ productId String
884
+ batchNumber String
885
+ internalBatchNumber String?
886
+ initialQuantity Float // Quantidade inicial adicionada ao estoque
887
+ currentQuantity Float // Quantidade atual disponível
888
+ expiryDate DateTime @db.Date
889
+ createdAt DateTime @default(now())
890
+ updatedAt DateTime @updatedAt
891
+ tenantId String?
892
+ product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
893
+ tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
887
894
 
888
895
  @@unique([productId, batchNumber])
889
896
  @@map("product_batch")