added property_id to plan table

This commit is contained in:
Khalim Conn-Kowlessar 2023-08-16 11:58:51 +01:00
parent 96719308b3
commit 9fd9d0641e
5 changed files with 1290 additions and 2 deletions

View file

@ -0,0 +1,6 @@
ALTER TABLE "plan" ADD COLUMN "property_id" bigint NOT NULL;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "plan" ADD CONSTRAINT "plan_property_id_property_id_fk" FOREIGN KEY ("property_id") REFERENCES "property"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

File diff suppressed because it is too large Load diff

View file

@ -246,6 +246,13 @@
"when": 1692012985856,
"tag": "0034_wandering_nick_fury",
"breakpoints": true
},
{
"idx": 35,
"version": "5",
"when": 1692183485471,
"tag": "0035_perfect_tenebrous",
"breakpoints": true
}
]
}

View file

@ -70,6 +70,9 @@ export const plan = pgTable("plan", {
portfolioId: bigint("portfolio_id", { mode: "bigint" })
.notNull()
.references(() => portfolio.id),
propertyId: bigint("property_id", { mode: "bigint" })
.notNull()
.references(() => property.id),
createdAt: timestamp("created_at").notNull().defaultNow(),
isDefault: boolean("is_default").notNull(),
});

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,