test(fifo index): running fifo index data on 2 servers as a trial to validate data
This commit is contained in:
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