mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Added portfolioId to plan
This commit is contained in:
parent
5ebcea2ab0
commit
5e881f256a
4 changed files with 1251 additions and 0 deletions
6
src/app/db/migrations/0027_shocking_scrambler.sql
Normal file
6
src/app/db/migrations/0027_shocking_scrambler.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE "plan" ADD COLUMN "portfolio_id" bigint NOT NULL;--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "plan" ADD CONSTRAINT "plan_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "portfolio"("id") ON DELETE no action ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
1234
src/app/db/migrations/meta/0027_snapshot.json
Normal file
1234
src/app/db/migrations/meta/0027_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -190,6 +190,13 @@
|
|||
"when": 1691685306098,
|
||||
"tag": "0026_blue_randall",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 27,
|
||||
"version": "5",
|
||||
"when": 1691748727401,
|
||||
"tag": "0027_shocking_scrambler",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { property } from "./property";
|
||||
import { portfolio } from "./portfolio";
|
||||
import {
|
||||
bigserial,
|
||||
text,
|
||||
|
|
@ -63,6 +64,9 @@ export const recommendationMaterials = pgTable("recommendation_materials", {
|
|||
|
||||
export const plan = pgTable("plan", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
portfolioId: bigint("portfolio_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => portfolio.id),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
isDefault: boolean("is_default").notNull(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue