Migrating database to add new columns for new materials

This commit is contained in:
Khalim Conn-Kowlessar 2023-11-23 16:46:30 +00:00
parent 84eecd1b2c
commit 9c44e6b7ca
8 changed files with 2678 additions and 7 deletions

View file

@ -0,0 +1 @@
ALTER TABLE "material" RENAME COLUMN "depths" TO "depth";

View file

@ -0,0 +1,6 @@
ALTER TABLE "material" ADD COLUMN "prime_material_cost" real;--> statement-breakpoint
ALTER TABLE "material" ADD COLUMN "material_cost" real;--> statement-breakpoint
ALTER TABLE "material" ADD COLUMN "labour_cost" real;--> statement-breakpoint
ALTER TABLE "material" ADD COLUMN "labour_cost_per_unit" real;--> statement-breakpoint
ALTER TABLE "material" ADD COLUMN "plant_cost" real;--> statement-breakpoint
ALTER TABLE "material" ADD COLUMN "total_cost" real;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -316,6 +316,20 @@
"when": 1700490618083,
"tag": "0044_huge_shocker",
"breakpoints": true
},
{
"idx": 45,
"version": "5",
"when": 1700757832683,
"tag": "0045_happy_mister_sinister",
"breakpoints": true
},
{
"idx": 46,
"version": "5",
"when": 1700757960766,
"tag": "0046_lonely_jack_flag",
"breakpoints": true
}
]
}

View file

@ -46,9 +46,9 @@ export const material = pgTable("material", {
id: bigserial("id", { mode: "bigint" }).primaryKey(),
type: materialTypeEnum("type").notNull(),
description: text("description").notNull(),
depths: json("depths").$type<number[]>(),
depth: json("depth").$type<number[]>(),
depth_unit: depthUnitEnum("depth_unit"),
cost: json("cost").$type<number[]>(),
costUnit: costUnitEnum("cost_unit"),
rValuePerMm: real("r_value_per_mm"),
rValueUnit: rValueUnitEnum("r_value_unit"),
@ -59,4 +59,11 @@ export const material = pgTable("material", {
link: text("link"),
createdAt: timestamp("created_at").notNull().defaultNow(),
isActive: boolean("is_active").notNull().default(true),
prime_material_cost: real("prime_material_cost"),
material_cost: real("material_cost"),
labour_cost: real("labour_cost"),
labour_cost_per_unit: real("labour_cost_per_unit"),
plant_cost: real("plant_cost"),
total_cost: real("total_cost"),
cost: json("cost").$type<number[]>(),
});

View file

@ -10,9 +10,6 @@ export default async function PortfolioPlan({
const portfolioId = params.slug;
const portfolioPlan = await getPortfolioPlan(portfolioId);
console.log("HIHI");
console.log(portfolioPlan);
return (
<>
<div className="flex justify-center mt-8">

View file

@ -1,8 +1,8 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"target": "es5",
// "target": "ESNext",
// "target": "es5",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,