@juliobrim/prisma-shared 1.0.31 → 1.0.33

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,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");
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "public"."product_batch" ADD COLUMN "supplier" TEXT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juliobrim/prisma-shared",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "Schema Prisma compartilhado entre projetos Sabcon",
5
5
  "main": "schema.prisma",
6
6
  "files": [
package/schema.prisma CHANGED
@@ -879,16 +879,19 @@ model DeviceOperator {
879
879
  }
880
880
 
881
881
  model ProductBatch {
882
- id String @id @default(cuid())
883
- productId String
884
- batchNumber String
885
- quantity Float
886
- expiryDate DateTime @db.Date
887
- createdAt DateTime @default(now())
888
- updatedAt DateTime @updatedAt
889
- tenantId String?
890
- product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
891
- tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
882
+ id Int @id @default(autoincrement())
883
+ productId String
884
+ supplier String?
885
+ batchNumber String
886
+ internalBatchNumber String?
887
+ initialQuantity Float // Quantidade inicial adicionada ao estoque
888
+ currentQuantity Float // Quantidade atual disponível
889
+ expiryDate DateTime @db.Date
890
+ createdAt DateTime @default(now())
891
+ updatedAt DateTime @updatedAt
892
+ tenantId String?
893
+ product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
894
+ tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
892
895
 
893
896
  @@unique([productId, batchNumber])
894
897
  @@map("product_batch")