mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
created new tables for plan and planRecommendations
This commit is contained in:
parent
f7073943a5
commit
a650162dda
4 changed files with 1258 additions and 1 deletions
36
src/app/db/migrations/0025_illegal_psylocke.sql
Normal file
36
src/app/db/migrations/0025_illegal_psylocke.sql
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
CREATE TABLE IF NOT EXISTS "plan" (
|
||||
"id" bigserial PRIMARY KEY NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"is_default" boolean NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "plan_recommendations" (
|
||||
"id" bigserial PRIMARY KEY NOT NULL,
|
||||
"plan_id" bigint NOT NULL,
|
||||
"recommendation_id" bigint NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "property_id" bigint NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "co2_equivalent_savings" real;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "energy_savings" real;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "energy_cost_savings" real;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "property_valuation_increase" real;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "rental_yield_increase" real;--> statement-breakpoint
|
||||
ALTER TABLE "recommendation" ADD COLUMN "total_work_hours" real;--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "recommendation" ADD CONSTRAINT "recommendation_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 $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "plan_recommendations" ADD CONSTRAINT "plan_recommendations_plan_id_plan_id_fk" FOREIGN KEY ("plan_id") REFERENCES "plan"("id") ON DELETE no action ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "plan_recommendations" ADD CONSTRAINT "plan_recommendations_recommendation_id_recommendation_id_fk" FOREIGN KEY ("recommendation_id") REFERENCES "recommendation"("id") ON DELETE no action ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
1214
src/app/db/migrations/meta/0025_snapshot.json
Normal file
1214
src/app/db/migrations/meta/0025_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -176,6 +176,13 @@
|
|||
"when": 1691664707792,
|
||||
"tag": "0024_clean_polaris",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 25,
|
||||
"version": "5",
|
||||
"when": 1691681879576,
|
||||
"tag": "0025_illegal_psylocke",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { property } from "@/app/db/schema/property";
|
||||
import { property } from "./property";
|
||||
import {
|
||||
bigserial,
|
||||
text,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue