import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; import { buildings } from "./buildings.js"; import { projects } from "./projects.js"; export const floors = sqliteTable("floors", { id: text("id").primaryKey(), projectId: text("project_id") .notNull() .references(() => projects.id, { onDelete: "cascade" }), name: text("name").notNull(), sortOrder: integer("sort_order").notNull().default(0), // Optional parent building. Floors created before buildings existed stay // without one and are shown as "Ohne Gebäude". buildingId: text("building_id").references(() => buildings.id, { onDelete: "set null", }), });