Merge pull request #269 from Hestia-Homes/feature/uploaded_file_id_in_magic_plan_plan

Add uploaded_file_id fk to magic_plan_plan table
This commit is contained in:
Daniel Roth 2026-05-13 14:47:05 +01:00 committed by GitHub
commit 418175f2c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9445 additions and 6 deletions

View file

@ -0,0 +1,3 @@
ALTER TABLE "magic_plan_plan" ADD COLUMN "uploaded_file_id" bigint;--> statement-breakpoint
ALTER TABLE "magic_plan_plan" ADD CONSTRAINT "magic_plan_plan_uploaded_file_id_uploaded_files_id_fk" FOREIGN KEY ("uploaded_file_id") REFERENCES "public"."uploaded_files"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "magic_plan_plan" ADD CONSTRAINT "magic_plan_plan_uploaded_file_id_unique" UNIQUE("uploaded_file_id");

File diff suppressed because it is too large Load diff

View file

@ -1415,6 +1415,13 @@
"when": 1778602691863,
"tag": "0201_known_sebastian_shaw",
"breakpoints": true
},
{
"idx": 202,
"version": "7",
"when": 1778666596489,
"tag": "0202_furry_mister_sinister",
"breakpoints": true
}
]
}

View file

@ -1,12 +1,16 @@
import { pgTable, bigserial, text } from "drizzle-orm/pg-core";
import { pgTable, bigserial, text, bigint } from "drizzle-orm/pg-core";
import { uploadedFiles } from "../uploaded_files";
export const magicPlanPlan = pgTable(
"magic_plan_plan",
{
id: bigserial("id", { mode: "bigint" }).primaryKey(),
name: text("name"),
address: text("address"),
postcode: text("postcode"),
magicPlanUid: text("magic_plan_uid").unique(),
id: bigserial("id", { mode: "bigint" }).primaryKey(),
name: text("name"),
address: text("address"),
postcode: text("postcode"),
magicPlanUid: text("magic_plan_uid").unique(),
uploadedFileId: bigint("uploaded_file_id", { mode: "bigint" })
.unique()
.references(() => uploadedFiles.id),
},
);