fix(database): correction to the printer modules
This commit is contained in:
2
database/migrations/0034_massive_penance.sql
Normal file
2
database/migrations/0034_massive_penance.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "printers" ALTER COLUMN "lastTimePrinted" SET DATA TYPE timestamp;--> statement-breakpoint
|
||||||
|
ALTER TABLE "printers" ADD COLUMN "printDelay" numeric;
|
||||||
2
database/migrations/0035_even_adam_warlock.sql
Normal file
2
database/migrations/0035_even_adam_warlock.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "printers" ALTER COLUMN "lastTimePrinted" SET DEFAULT now();--> statement-breakpoint
|
||||||
|
ALTER TABLE "printers" ALTER COLUMN "lastTimePrinted" SET NOT NULL;
|
||||||
1
database/migrations/0036_fixed_spacker_dave.sql
Normal file
1
database/migrations/0036_fixed_spacker_dave.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "printers" ALTER COLUMN "lastTimePrinted" SET DATA TYPE timestamp with time zone;
|
||||||
1
database/migrations/0037_cooing_orphan.sql
Normal file
1
database/migrations/0037_cooing_orphan.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "printers" DROP COLUMN "lastTimePrinted";
|
||||||
1
database/migrations/0038_lumpy_kitty_pryde.sql
Normal file
1
database/migrations/0038_lumpy_kitty_pryde.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "printers" DROP COLUMN "printDelay";
|
||||||
19
database/migrations/0039_greedy_steve_rogers.sql
Normal file
19
database/migrations/0039_greedy_steve_rogers.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
CREATE TABLE "printerData" (
|
||||||
|
"printer_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"humanReadableId" text,
|
||||||
|
"name" text NOT NULL,
|
||||||
|
"ipAddress" text,
|
||||||
|
"port" numeric,
|
||||||
|
"status" text,
|
||||||
|
"statusText" text,
|
||||||
|
"lastTimePrinted" timestamp DEFAULT now() NOT NULL,
|
||||||
|
"assigned" boolean DEFAULT false,
|
||||||
|
"remark" text,
|
||||||
|
"printDelay" numeric,
|
||||||
|
"monitorState" boolean DEFAULT false,
|
||||||
|
"add_Date" timestamp DEFAULT now(),
|
||||||
|
"upd_date" timestamp DEFAULT now()
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
DROP TABLE "printers" CASCADE;--> statement-breakpoint
|
||||||
|
CREATE UNIQUE INDEX "humanReadableId" ON "printerData" USING btree ("humanReadableId");
|
||||||
17
database/migrations/0040_luxuriant_aqueduct.sql
Normal file
17
database/migrations/0040_luxuriant_aqueduct.sql
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
CREATE TABLE "subModules" (
|
||||||
|
"submodule_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"moduleName" text NOT NULL,
|
||||||
|
"name" text NOT NULL,
|
||||||
|
"description" text,
|
||||||
|
"link" text NOT NULL,
|
||||||
|
"active" boolean DEFAULT false,
|
||||||
|
"roles" jsonb DEFAULT '["systemAdmin"]'::jsonb NOT NULL,
|
||||||
|
"subSubModule" jsonb DEFAULT '[]'::jsonb,
|
||||||
|
"add_User" text DEFAULT 'LST_System' NOT NULL,
|
||||||
|
"add_Date" timestamp DEFAULT now(),
|
||||||
|
"upd_User" text DEFAULT 'LST_System' NOT NULL,
|
||||||
|
"upd_date" timestamp DEFAULT now()
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "subModules" ADD CONSTRAINT "subModules_moduleName_modules_name_fk" FOREIGN KEY ("moduleName") REFERENCES "public"."modules"("name") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
CREATE UNIQUE INDEX "subModule_name" ON "subModules" USING btree ("name");
|
||||||
1
database/migrations/0041_wise_molten_man.sql
Normal file
1
database/migrations/0041_wise_molten_man.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX "subModule_name";
|
||||||
3
database/migrations/0042_big_power_pack.sql
Normal file
3
database/migrations/0042_big_power_pack.sql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE "subModules" DROP CONSTRAINT "subModules_moduleName_modules_name_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "subModules" ALTER COLUMN "moduleName" DROP NOT NULL;
|
||||||
1366
database/migrations/meta/0034_snapshot.json
Normal file
1366
database/migrations/meta/0034_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1367
database/migrations/meta/0035_snapshot.json
Normal file
1367
database/migrations/meta/0035_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1367
database/migrations/meta/0036_snapshot.json
Normal file
1367
database/migrations/meta/0036_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1360
database/migrations/meta/0037_snapshot.json
Normal file
1360
database/migrations/meta/0037_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1354
database/migrations/meta/0038_snapshot.json
Normal file
1354
database/migrations/meta/0038_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1367
database/migrations/meta/0039_snapshot.json
Normal file
1367
database/migrations/meta/0039_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1490
database/migrations/meta/0040_snapshot.json
Normal file
1490
database/migrations/meta/0040_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1474
database/migrations/meta/0041_snapshot.json
Normal file
1474
database/migrations/meta/0041_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
1460
database/migrations/meta/0042_snapshot.json
Normal file
1460
database/migrations/meta/0042_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -239,6 +239,69 @@
|
|||||||
"when": 1743424730855,
|
"when": 1743424730855,
|
||||||
"tag": "0033_flimsy_salo",
|
"tag": "0033_flimsy_salo",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 34,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743720994399,
|
||||||
|
"tag": "0034_massive_penance",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 35,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743721140937,
|
||||||
|
"tag": "0035_even_adam_warlock",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 36,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743721251498,
|
||||||
|
"tag": "0036_fixed_spacker_dave",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 37,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743721424503,
|
||||||
|
"tag": "0037_cooing_orphan",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 38,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743729665453,
|
||||||
|
"tag": "0038_lumpy_kitty_pryde",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 39,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743771209867,
|
||||||
|
"tag": "0039_greedy_steve_rogers",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 40,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743776921664,
|
||||||
|
"tag": "0040_luxuriant_aqueduct",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 41,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743778410407,
|
||||||
|
"tag": "0041_wise_molten_man",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 42,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1743778477759,
|
||||||
|
"tag": "0042_big_power_pack",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,8 @@ import {
|
|||||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const printers = pgTable(
|
export const printerData = pgTable(
|
||||||
"printers",
|
"printerData",
|
||||||
{
|
{
|
||||||
printer_id: uuid("printer_id").defaultRandom().primaryKey(),
|
printer_id: uuid("printer_id").defaultRandom().primaryKey(),
|
||||||
humanReadableId: text("humanReadableId"),
|
humanReadableId: text("humanReadableId"),
|
||||||
@@ -21,9 +21,10 @@ export const printers = pgTable(
|
|||||||
port: numeric("port"),
|
port: numeric("port"),
|
||||||
status: text("status"),
|
status: text("status"),
|
||||||
statusText: text("statusText"),
|
statusText: text("statusText"),
|
||||||
lastTimePrinted: text("lastTimePrinted"),
|
lastTimePrinted: timestamp("lastTimePrinted").notNull().defaultNow(),
|
||||||
assigned: boolean("assigned").default(false),
|
assigned: boolean("assigned").default(false),
|
||||||
remark: text("remark"),
|
remark: text("remark"),
|
||||||
|
printDelay: numeric("printDelay"),
|
||||||
monitorState: boolean("monitorState").default(false),
|
monitorState: boolean("monitorState").default(false),
|
||||||
add_Date: timestamp("add_Date").defaultNow(),
|
add_Date: timestamp("add_Date").defaultNow(),
|
||||||
upd_date: timestamp("upd_date").defaultNow(),
|
upd_date: timestamp("upd_date").defaultNow(),
|
||||||
@@ -39,4 +40,4 @@ export const printers = pgTable(
|
|||||||
// name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
|
// name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
|
||||||
// });
|
// });
|
||||||
// Schema for selecting a Expenses - can be used to validate API responses
|
// Schema for selecting a Expenses - can be used to validate API responses
|
||||||
export const selectRolesSchema = createSelectSchema(printers);
|
export const selectRolesSchema = createSelectSchema(printerData);
|
||||||
|
|||||||
Reference in New Issue
Block a user