From a8c5e7e9235323451dd52203a1f6f802edced169 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 6 May 2026 13:52:55 +0000 Subject: [PATCH] add magicplan tables --- src/app/db/schema/magic_plan/door.ts | 14 ++++++++++++++ src/app/db/schema/magic_plan/floor.ts | 13 +++++++++++++ src/app/db/schema/magic_plan/plan.ts | 10 ++++++++++ src/app/db/schema/magic_plan/room.ts | 16 ++++++++++++++++ src/app/db/schema/magic_plan/window.ts | 16 ++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 src/app/db/schema/magic_plan/door.ts create mode 100644 src/app/db/schema/magic_plan/floor.ts create mode 100644 src/app/db/schema/magic_plan/plan.ts create mode 100644 src/app/db/schema/magic_plan/room.ts create mode 100644 src/app/db/schema/magic_plan/window.ts diff --git a/src/app/db/schema/magic_plan/door.ts b/src/app/db/schema/magic_plan/door.ts new file mode 100644 index 00000000..f4770227 --- /dev/null +++ b/src/app/db/schema/magic_plan/door.ts @@ -0,0 +1,14 @@ +import { pgTable, bigserial, bigint, text, real } from "drizzle-orm/pg-core"; +import { magicPlanRoom } from "./room"; + +export const magicPlanDoor = pgTable( + "magic_plan_door", + { + id: bigserial("id", { mode: "bigint" }).primaryKey(), + roomId: bigint("magic_plan_room_id", { mode: "bigint" }) + .notNull() + .references(() => magicPlanRoom.id), + width_m: real("width_m"), + type: text("type"), + }, +); \ No newline at end of file diff --git a/src/app/db/schema/magic_plan/floor.ts b/src/app/db/schema/magic_plan/floor.ts new file mode 100644 index 00000000..76bf0e8c --- /dev/null +++ b/src/app/db/schema/magic_plan/floor.ts @@ -0,0 +1,13 @@ +import { pgTable, bigserial, bigint, integer } from "drizzle-orm/pg-core"; +import { magicPlanPlan } from "./plan"; + +export const magicPlanFloor = pgTable( + "magic_plan_floor", + { + id: bigserial("id", { mode: "bigint" }).primaryKey(), + planId: bigint("magic_plan_plan_id", { mode: "bigint" }) + .notNull() + .references(() => magicPlanPlan.id), + level: integer("level"), + }, +); \ No newline at end of file diff --git a/src/app/db/schema/magic_plan/plan.ts b/src/app/db/schema/magic_plan/plan.ts new file mode 100644 index 00000000..00a242df --- /dev/null +++ b/src/app/db/schema/magic_plan/plan.ts @@ -0,0 +1,10 @@ +import { pgTable, bigserial, text } from "drizzle-orm/pg-core"; + +export const magicPlanPlan = pgTable( + "magic_plan_plan", + { + id: bigserial("id", { mode: "bigint" }).primaryKey(), + planName: text("plan_name"), + address: text("address"), + }, +); \ No newline at end of file diff --git a/src/app/db/schema/magic_plan/room.ts b/src/app/db/schema/magic_plan/room.ts new file mode 100644 index 00000000..d6509fc1 --- /dev/null +++ b/src/app/db/schema/magic_plan/room.ts @@ -0,0 +1,16 @@ +import { pgTable, bigserial, bigint, text, real } from "drizzle-orm/pg-core"; +import { magicPlanFloor } from "./floor"; + +export const magicPlanRoom = pgTable( + "magic_plan_room", + { + id: bigserial("id", { mode: "bigint" }).primaryKey(), + floorId: bigint("magic_plan_floor_id", { mode: "bigint" }) + .notNull() + .references(() => magicPlanFloor.id), + name: text("name"), + width_m: real("width_m"), + length_m: real("length_m"), + area_m2: real("area_m2"), + }, +); \ No newline at end of file diff --git a/src/app/db/schema/magic_plan/window.ts b/src/app/db/schema/magic_plan/window.ts new file mode 100644 index 00000000..3077b0b4 --- /dev/null +++ b/src/app/db/schema/magic_plan/window.ts @@ -0,0 +1,16 @@ +import { pgTable, bigserial, bigint, text, real } from "drizzle-orm/pg-core"; +import { magicPlanRoom } from "./room"; + +export const magicPlanWindow = pgTable( + "magic_plan_window", + { + id: bigserial("id", { mode: "bigint" }).primaryKey(), + roomId: bigint("magic_plan_room_id", { mode: "bigint" }) + .notNull() + .references(() => magicPlanRoom.id), + width_m: real("width_m"), + height_m: real("width_m"), + area_m2: real("area_m2"), + opening_type: text("opening_type"), + }, +); \ No newline at end of file