@juliobrim/prisma-shared 1.0.19 → 1.0.20
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,21 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "public"."machine_sensors" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"machineId" TEXT NOT NULL,
|
|
5
|
+
"sensor1Name" TEXT,
|
|
6
|
+
"sensor2Name" TEXT,
|
|
7
|
+
"sensor1Show" BOOLEAN NOT NULL DEFAULT true,
|
|
8
|
+
"sensor2Show" BOOLEAN NOT NULL DEFAULT true,
|
|
9
|
+
"tenantId" TEXT,
|
|
10
|
+
|
|
11
|
+
CONSTRAINT "machine_sensors_pkey" PRIMARY KEY ("id")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
-- CreateIndex
|
|
15
|
+
CREATE UNIQUE INDEX "machine_sensors_machineId_key" ON "public"."machine_sensors"("machineId");
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "public"."machine_sensors" ADD CONSTRAINT "machine_sensors_machineId_fkey" FOREIGN KEY ("machineId") REFERENCES "public"."machine"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "public"."machine_sensors" ADD CONSTRAINT "machine_sensors_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "public"."tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -55,6 +55,7 @@ model Tenant {
|
|
|
55
55
|
MachineFormulaResult MachineFormulaResult[]
|
|
56
56
|
devices Device[]
|
|
57
57
|
deviceOperators DeviceOperator[]
|
|
58
|
+
machineSensors MachineSensors[]
|
|
58
59
|
|
|
59
60
|
@@map("tenant")
|
|
60
61
|
}
|
|
@@ -254,6 +255,7 @@ model Machine {
|
|
|
254
255
|
MachineFormula MachineFormula[]
|
|
255
256
|
MachineFormulaResult MachineFormulaResult[]
|
|
256
257
|
device Device?
|
|
258
|
+
machineSensors MachineSensors?
|
|
257
259
|
|
|
258
260
|
@@map("machine")
|
|
259
261
|
}
|
|
@@ -789,6 +791,21 @@ model Device {
|
|
|
789
791
|
@@map("device")
|
|
790
792
|
}
|
|
791
793
|
|
|
794
|
+
model MachineSensors {
|
|
795
|
+
id String @id @default(cuid())
|
|
796
|
+
machineId String @unique
|
|
797
|
+
sensor1Name String?
|
|
798
|
+
sensor2Name String?
|
|
799
|
+
sensor1Show Boolean @default(true)
|
|
800
|
+
sensor2Show Boolean @default(true)
|
|
801
|
+
tenantId String?
|
|
802
|
+
|
|
803
|
+
machine Machine? @relation(fields: [machineId], references: [id])
|
|
804
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
805
|
+
|
|
806
|
+
@@map("machine_sensors")
|
|
807
|
+
}
|
|
808
|
+
|
|
792
809
|
model DeviceOperator {
|
|
793
810
|
id String @id @default(cuid())
|
|
794
811
|
deviceId String
|