mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +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,
|
||||
"tag": "0136_boring_charles_xavier",
|
||||
"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 unitQuantityEnum = pgEnum("unit_quantity", unitQuantity);
|
||||
|
||||
export const recommendationMaterials = pgTable("recommendation_materials", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
recommendationId: bigint("recommendation_id", {
|
||||
mode: "bigint",
|
||||
})
|
||||
.notNull()
|
||||
.references(() => recommendation.id),
|
||||
materialId: bigint("material_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => material.id),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
depth: real("depth"),
|
||||
quantity: real("quantity"),
|
||||
quantityUnit: unitQuantityEnum("quantity_unit"),
|
||||
estimatedCost: real("estimated_cost").notNull(),
|
||||
});
|
||||
export const recommendationMaterials = pgTable(
|
||||
"recommendation_materials",
|
||||
{
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
recommendationId: bigint("recommendation_id", {
|
||||
mode: "bigint",
|
||||
})
|
||||
.notNull()
|
||||
.references(() => recommendation.id),
|
||||
materialId: bigint("material_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => material.id),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
depth: real("depth"),
|
||||
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
|
||||
export const PlanType: [string, ...string[]] = [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue