@juliobrim/prisma-shared 1.0.35 → 1.0.40

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,27 @@
1
+ -- AlterTable
2
+ ALTER TABLE "public"."machine" ADD COLUMN "processingScriptId" TEXT;
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "public"."processing_script" (
6
+ "id" TEXT NOT NULL,
7
+ "name" TEXT NOT NULL,
8
+ "description" TEXT,
9
+ "script" TEXT NOT NULL,
10
+ "isDefault" BOOLEAN NOT NULL DEFAULT false,
11
+ "tenantId" TEXT,
12
+ "version" INTEGER NOT NULL DEFAULT 1,
13
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
14
+ "updatedAt" TIMESTAMP(3) NOT NULL,
15
+ "createdBy" TEXT,
16
+
17
+ CONSTRAINT "processing_script_pkey" PRIMARY KEY ("id")
18
+ );
19
+
20
+ -- CreateIndex
21
+ CREATE INDEX "processing_script_tenantId_idx" ON "public"."processing_script"("tenantId");
22
+
23
+ -- AddForeignKey
24
+ ALTER TABLE "public"."machine" ADD CONSTRAINT "machine_processingScriptId_fkey" FOREIGN KEY ("processingScriptId") REFERENCES "public"."processing_script"("id") ON DELETE SET NULL ON UPDATE CASCADE;
25
+
26
+ -- AddForeignKey
27
+ ALTER TABLE "public"."processing_script" ADD CONSTRAINT "processing_script_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "public"."tenant"("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.35",
3
+ "version": "1.0.40",
4
4
  "description": "Schema Prisma compartilhado entre projetos Sabcon",
5
5
  "main": "schema.prisma",
6
6
  "files": [
package/schema.prisma CHANGED
@@ -55,6 +55,7 @@ model Tenant {
55
55
  sewMachineRawData SewMachineRawData[]
56
56
  shifts Shift[]
57
57
  systemPreferences SystemPreferences[]
58
+ processingScripts ProcessingScript[]
58
59
  users User[]
59
60
  userPermissions UserPermission[]
60
61
  userShifts UserShift[]
@@ -264,12 +265,32 @@ model Machine {
264
265
  operationRegister OperationRegister[]
265
266
  productionNodes ProductionNode?
266
267
  operationResources Resource[] @relation("MachineToResource")
268
+ processingScriptId String?
269
+ processingScript ProcessingScript? @relation(fields: [processingScriptId], references: [id])
267
270
  MachineProcessingScript MachineProcessingScript?
268
271
  MachineScriptState MachineScriptState?
269
272
 
270
273
  @@map("machine")
271
274
  }
272
275
 
276
+ model ProcessingScript {
277
+ id String @id @default(cuid())
278
+ name String
279
+ description String?
280
+ script String
281
+ isDefault Boolean @default(false)
282
+ tenantId String?
283
+ version Int @default(1)
284
+ createdAt DateTime @default(now())
285
+ updatedAt DateTime @updatedAt
286
+ createdBy String?
287
+ machines Machine[]
288
+ tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
289
+
290
+ @@index([tenantId])
291
+ @@map("processing_script")
292
+ }
293
+
273
294
  model MachineFormula {
274
295
  id String @id @default(cuid())
275
296
  machineId String