add magicplan tables

This commit is contained in:
Daniel Roth 2026-05-06 13:52:55 +00:00
parent f8bbb19b07
commit a8c5e7e923
5 changed files with 69 additions and 0 deletions

View file

@ -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"),
},
);

View file

@ -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"),
},
);

View file

@ -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"),
},
);

View file

@ -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"),
},
);

View file

@ -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"),
},
);