31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { date, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
|
import type z from "zod";
|
|
|
|
export const invHistoricalData = pgTable("inv_historical_data", {
|
|
inv: uuid("id").defaultRandom().primaryKey(),
|
|
histDate: date("hist_date").notNull(), // this date should always be yesterday when we post it.
|
|
plantToken: text("plant_token"),
|
|
article: text("article").notNull(),
|
|
articleDescription: text("article_description").notNull(),
|
|
materialType: text("material_type"),
|
|
total_QTY: text("total_QTY"),
|
|
available_QTY: text("available_QTY"),
|
|
coa_QTY: text("coa_QTY"),
|
|
held_QTY: text("held_QTY"),
|
|
consignment_QTY: text("consignment_qty"),
|
|
lot_Number: text("lot_number"),
|
|
locationId: text("location_id"),
|
|
location: text("location"),
|
|
whseId: text("whse_id").default(""),
|
|
whseName: text("whse_name").default("missing whseName"),
|
|
upd_user: text("upd_user").default("lst-system"),
|
|
upd_date: timestamp("upd_date").defaultNow(),
|
|
});
|
|
|
|
export const invHistoricalDataSchema = createSelectSchema(invHistoricalData);
|
|
export const newInvHistoricalDataSchema = createInsertSchema(invHistoricalData);
|
|
|
|
export type InvHistoricalData = z.infer<typeof invHistoricalDataSchema>;
|
|
export type NewInvHistoricalData = z.infer<typeof newInvHistoricalDataSchema>;
|