feat(eom): added in historical inv data split accordingly
This commit is contained in:
16
database/migrations/0062_narrow_silver_centurion.sql
Normal file
16
database/migrations/0062_narrow_silver_centurion.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE "invHistoricalData" (
|
||||
"inv_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"histDate" date NOT NULL,
|
||||
"plantToken" text,
|
||||
"article" text NOT NULL,
|
||||
"articleDescription" text NOT NULL,
|
||||
"materialType" text,
|
||||
"total_QTY" integer,
|
||||
"avaliable_QTY" integer,
|
||||
"coa_QTY" integer,
|
||||
"held_QTY" integer,
|
||||
"consignment" integer,
|
||||
"location" integer,
|
||||
"upd_user" text,
|
||||
"upd_date" timestamp
|
||||
);
|
||||
5
database/migrations/0063_powerful_revanche.sql
Normal file
5
database/migrations/0063_powerful_revanche.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE "invHistoricalData" ALTER COLUMN "total_QTY" SET DATA TYPE text;--> statement-breakpoint
|
||||
ALTER TABLE "invHistoricalData" ALTER COLUMN "coa_QTY" SET DATA TYPE text;--> statement-breakpoint
|
||||
ALTER TABLE "invHistoricalData" ALTER COLUMN "held_QTY" SET DATA TYPE text;--> statement-breakpoint
|
||||
ALTER TABLE "invHistoricalData" ALTER COLUMN "consignment" SET DATA TYPE text;--> statement-breakpoint
|
||||
ALTER TABLE "invHistoricalData" ALTER COLUMN "location" SET DATA TYPE text;
|
||||
1
database/migrations/0064_aberrant_blindfold.sql
Normal file
1
database/migrations/0064_aberrant_blindfold.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE "invHistoricalData" ALTER COLUMN "avaliable_QTY" SET DATA TYPE text;
|
||||
2023
database/migrations/meta/0062_snapshot.json
Normal file
2023
database/migrations/meta/0062_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2023
database/migrations/meta/0063_snapshot.json
Normal file
2023
database/migrations/meta/0063_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2023
database/migrations/meta/0064_snapshot.json
Normal file
2023
database/migrations/meta/0064_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -435,6 +435,27 @@
|
||||
"when": 1748370693078,
|
||||
"tag": "0061_mature_the_stranger",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 62,
|
||||
"version": "7",
|
||||
"when": 1748462132080,
|
||||
"tag": "0062_narrow_silver_centurion",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 63,
|
||||
"version": "7",
|
||||
"when": 1748463780733,
|
||||
"tag": "0063_powerful_revanche",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 64,
|
||||
"version": "7",
|
||||
"when": 1748464203006,
|
||||
"tag": "0064_aberrant_blindfold",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,12 +1,43 @@
|
||||
import {date, pgTable, text} from "drizzle-orm/pg-core";
|
||||
import {createSelectSchema} from "drizzle-zod";
|
||||
import {
|
||||
date,
|
||||
integer,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { createSelectSchema } from "drizzle-zod";
|
||||
|
||||
export const eom = pgTable(
|
||||
"eom",
|
||||
{
|
||||
eomMonth: date().notNull(),
|
||||
article: text().notNull(),
|
||||
articleDescription: text().notNull(),
|
||||
eom_id: uuid("eom_id").defaultRandom().primaryKey(),
|
||||
eomMonth: date("eomMonth").notNull(), // what month are we running in should just be the first of current month
|
||||
plantToken: text("plantToken"),
|
||||
article: text("article").notNull(),
|
||||
articleDescription: text("articleDescription").notNull(),
|
||||
materialType: text("materialType"),
|
||||
invStart: integer("invStart"), // this will come from the previous month
|
||||
invEnd: integer("invEnd"),
|
||||
intransit: integer("intransit"),
|
||||
// pass over a calculation for ending inv
|
||||
purchase: integer("purchase"),
|
||||
gpRecived: integer("gpRecived"),
|
||||
// pass calcuation for difference
|
||||
materialIn: integer("materialIn"), // from other alpla plants
|
||||
materialOut: integer("materialOut"), // out to other alpla plants
|
||||
quarantine: integer("quarantine"),
|
||||
// calcualtion for actaul consumption
|
||||
prodConsumption: integer("prodConsumption"),
|
||||
// difference will be a calculated number
|
||||
// waste will be calculated.
|
||||
priceKg: text("priceKg"), // will be converted to a float and then calcuated into the data
|
||||
// loss/gain calcualtion
|
||||
comments: text("comments"),
|
||||
weight: text("weight"), // for calculations should be converted to a float
|
||||
pfc: text("pfc"), // profit center this will belong too.
|
||||
upd_user: text("upd_user"),
|
||||
upd_date: timestamp("upd_date"),
|
||||
}
|
||||
// (table) => [
|
||||
// // uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
|
||||
40
database/schema/historicalINV.ts
Normal file
40
database/schema/historicalINV.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
date,
|
||||
integer,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { createSelectSchema } from "drizzle-zod";
|
||||
|
||||
export const invHistoricalData = pgTable(
|
||||
"invHistoricalData",
|
||||
{
|
||||
inv_id: uuid("inv_id").defaultRandom().primaryKey(),
|
||||
histDate: date("histDate").notNull(), // what month are we running in should just be the first of current month
|
||||
plantToken: text("plantToken"),
|
||||
article: text("article").notNull(),
|
||||
articleDescription: text("articleDescription").notNull(),
|
||||
materialType: text("materialType"),
|
||||
total_QTY: text("total_QTY"),
|
||||
avaliable_QTY: text("avaliable_QTY"),
|
||||
coa_QTY: text("coa_QTY"),
|
||||
held_QTY: text("held_QTY"),
|
||||
consignment: text("consignment"),
|
||||
location: text("location"),
|
||||
upd_user: text("upd_user"),
|
||||
upd_date: timestamp("upd_date"),
|
||||
}
|
||||
// (table) => [
|
||||
// // uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
// uniqueIndex("role_name").on(table.name),
|
||||
// ]
|
||||
);
|
||||
|
||||
// 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(invHistoricalData);
|
||||
Reference in New Issue
Block a user