test(fifo index): running fifo index data on 2 servers as a trial to validate data
This commit is contained in:
11
database/migrations/0061_mature_the_stranger.sql
Normal file
11
database/migrations/0061_mature_the_stranger.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE "fifoIndex" (
|
||||
"fifoIndex_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"lot" text NOT NULL,
|
||||
"av" numeric NOT NULL,
|
||||
"runningNr" numeric NOT NULL,
|
||||
"prodDate" timestamp NOT NULL,
|
||||
"fifoFollowed" boolean NOT NULL,
|
||||
"add_Date" timestamp DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "fifo_runningNr" ON "fifoIndex" USING btree ("runningNr");
|
||||
1925
database/migrations/meta/0061_snapshot.json
Normal file
1925
database/migrations/meta/0061_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -428,6 +428,13 @@
|
||||
"when": 1747357513268,
|
||||
"tag": "0060_daffy_overlord",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 61,
|
||||
"version": "7",
|
||||
"when": 1748370693078,
|
||||
"tag": "0061_mature_the_stranger",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
40
database/schema/fifoIndex.ts
Normal file
40
database/schema/fifoIndex.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
text,
|
||||
pgTable,
|
||||
numeric,
|
||||
index,
|
||||
timestamp,
|
||||
boolean,
|
||||
uuid,
|
||||
uniqueIndex,
|
||||
jsonb,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
export const fifoIndex = pgTable(
|
||||
"fifoIndex",
|
||||
{
|
||||
fifoIndex_id: uuid("fifoIndex_id").defaultRandom().primaryKey(),
|
||||
lot: text("lot").notNull(),
|
||||
av: numeric("av").notNull(),
|
||||
runningNr: numeric("runningNr").notNull(),
|
||||
prodDate: timestamp("prodDate").notNull(),
|
||||
|
||||
// currentInv: jsonb("currentInv").default([]),
|
||||
fifoFollowed: boolean("fifoFollowed").notNull(),
|
||||
add_Date: timestamp("add_Date").defaultNow(),
|
||||
},
|
||||
(table) => [
|
||||
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
// uniqueIndex("role_name").on(table.name),
|
||||
uniqueIndex("fifo_runningNr").on(table.runningNr),
|
||||
]
|
||||
);
|
||||
|
||||
// Schema for inserting a user - can be used to validate API requests
|
||||
// export const insertRolesSchema = createInsertSchema(roles, {
|
||||
// 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
|
||||
export const selectRolesSchema = createSelectSchema(fifoIndex);
|
||||
Reference in New Issue
Block a user