mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-12 13:28:55 +00:00
added index on recommendations materials
This commit is contained in:
parent
fb342d0955
commit
b248a1bee2
4 changed files with 4859 additions and 16 deletions
1
src/app/db/migrations/0137_shallow_speedball.sql
Normal file
1
src/app/db/migrations/0137_shallow_speedball.sql
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
CREATE INDEX "recommendation_materials_recommendation_id_idx" ON "recommendation_materials" USING btree ("recommendation_id");
|
||||||
4827
src/app/db/migrations/meta/0137_snapshot.json
Normal file
4827
src/app/db/migrations/meta/0137_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -960,6 +960,13 @@
|
||||||
"when": 1765397663012,
|
"when": 1765397663012,
|
||||||
"tag": "0136_boring_charles_xavier",
|
"tag": "0136_boring_charles_xavier",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 137,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1765400667595,
|
||||||
|
"tag": "0137_shallow_speedball",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -52,22 +52,30 @@ export const recommendation = pgTable(
|
||||||
export const unitQuantity: [string, ...string[]] = ["m2", "part", "kwp"];
|
export const unitQuantity: [string, ...string[]] = ["m2", "part", "kwp"];
|
||||||
export const unitQuantityEnum = pgEnum("unit_quantity", unitQuantity);
|
export const unitQuantityEnum = pgEnum("unit_quantity", unitQuantity);
|
||||||
|
|
||||||
export const recommendationMaterials = pgTable("recommendation_materials", {
|
export const recommendationMaterials = pgTable(
|
||||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
"recommendation_materials",
|
||||||
recommendationId: bigint("recommendation_id", {
|
{
|
||||||
mode: "bigint",
|
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||||
})
|
recommendationId: bigint("recommendation_id", {
|
||||||
.notNull()
|
mode: "bigint",
|
||||||
.references(() => recommendation.id),
|
})
|
||||||
materialId: bigint("material_id", { mode: "bigint" })
|
.notNull()
|
||||||
.notNull()
|
.references(() => recommendation.id),
|
||||||
.references(() => material.id),
|
materialId: bigint("material_id", { mode: "bigint" })
|
||||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
.notNull()
|
||||||
depth: real("depth"),
|
.references(() => material.id),
|
||||||
quantity: real("quantity"),
|
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||||
quantityUnit: unitQuantityEnum("quantity_unit"),
|
depth: real("depth"),
|
||||||
estimatedCost: real("estimated_cost").notNull(),
|
quantity: real("quantity"),
|
||||||
});
|
quantityUnit: unitQuantityEnum("quantity_unit"),
|
||||||
|
estimatedCost: real("estimated_cost").notNull(),
|
||||||
|
},
|
||||||
|
(table) => [
|
||||||
|
index("recommendation_materials_recommendation_id_idx").on(
|
||||||
|
table.recommendationId
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
// We create a plan type, for common plan types that we produce for clients
|
// We create a plan type, for common plan types that we produce for clients
|
||||||
export const PlanType: [string, ...string[]] = [
|
export const PlanType: [string, ...string[]] = [
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue