mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
add plan_id column to recommendation table
This commit is contained in:
parent
57d0305a1b
commit
c40e64bdec
4 changed files with 10731 additions and 0 deletions
3
src/app/db/migrations/0222_nifty_hellcat.sql
Normal file
3
src/app/db/migrations/0222_nifty_hellcat.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE "recommendation" ADD COLUMN "plan_id" bigint;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD CONSTRAINT "recommendation_plan_id_plan_id_fk" FOREIGN KEY ("plan_id") REFERENCES "public"."plan"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "idx_recommendation_plan_id" ON "recommendation" USING btree ("plan_id");
|
||||
10717
src/app/db/migrations/meta/0222_snapshot.json
Normal file
10717
src/app/db/migrations/meta/0222_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1548,6 +1548,13 @@
|
|||
"when": 1780566543108,
|
||||
"tag": "0221_nice_sumo",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 222,
|
||||
"version": "7",
|
||||
"when": 1780647165601,
|
||||
"tag": "0222_nifty_hellcat",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -67,6 +67,9 @@ export const recommendation = pgTable(
|
|||
propertyId: bigint("property_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => property.id),
|
||||
planId: bigint("plan_id", { mode: "bigint" }).references(() => plan.id, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
type: text("type").notNull(),
|
||||
measureType: text("measure_type"),
|
||||
|
|
@ -92,6 +95,7 @@ export const recommendation = pgTable(
|
|||
},
|
||||
(table) => [
|
||||
index("recommendation_property_id_idx").on(table.propertyId),
|
||||
index("idx_recommendation_plan_id").on(table.planId),
|
||||
index("idx_recommendation_active_defaults")
|
||||
.on(table.id)
|
||||
.where(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue