From 76e40cd9e18c7ff55cf71a1d6f40c51c26896bdc Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 7 Dec 2025 17:11:26 +0100 Subject: [PATCH] db changes --- db/schema/costcentres.ts | 4 ++-- db/schema/inventoryitems.ts | 6 +++--- db/schema/products.ts | 18 +++++++++--------- db/schema/servicecategories.ts | 6 +++--- db/schema/spaces.ts | 4 ++-- db/schema/vehicles.ts | 16 ++++++++-------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/db/schema/costcentres.ts b/db/schema/costcentres.ts index b57a21a..7dccb10 100644 --- a/db/schema/costcentres.ts +++ b/db/schema/costcentres.ts @@ -9,7 +9,7 @@ import { } from "drizzle-orm/pg-core" import { tenants } from "./tenants" -import { inventoryItems } from "./inventoryitems" +import { inventoryitems } from "./inventoryitems" import { projects } from "./projects" import { vehicles } from "./vehicles" import { authUsers } from "./auth_users" @@ -33,7 +33,7 @@ export const costcentres = pgTable("costcentres", { project: bigint("project", { mode: "number" }).references(() => projects.id), inventoryitem: bigint("inventoryitem", { mode: "number" }).references( - () => inventoryItems.id + () => inventoryitems.id ), description: text("description"), diff --git a/db/schema/inventoryitems.ts b/db/schema/inventoryitems.ts index 9a56d5d..f3437d8 100644 --- a/db/schema/inventoryitems.ts +++ b/db/schema/inventoryitems.ts @@ -15,7 +15,7 @@ import { vendors } from "./vendors" import { spaces } from "./spaces" import { authUsers } from "./auth_users" -export const inventoryItems = pgTable("inventoryitems", { +export const inventoryitems = pgTable("inventoryitems", { id: bigint("id", { mode: "number" }) .primaryKey() .generatedByDefaultAsIdentity(), @@ -64,5 +64,5 @@ export const inventoryItems = pgTable("inventoryitems", { ), }) -export type InventoryItem = typeof inventoryItems.$inferSelect -export type NewInventoryItem = typeof inventoryItems.$inferInsert +export type InventoryItem = typeof inventoryitems.$inferSelect +export type NewInventoryItem = typeof inventoryitems.$inferInsert diff --git a/db/schema/products.ts b/db/schema/products.ts index 3379d21..d070254 100644 --- a/db/schema/products.ts +++ b/db/schema/products.ts @@ -40,16 +40,16 @@ export const products = pgTable("products", { ean: text("ean"), barcode: text("barcode"), - purchasePrice: doublePrecision("purchasePrice"), - sellingPrice: doublePrecision("sellingPrice"), + purchase_price: doublePrecision("purchasePrice"), + selling_price: doublePrecision("sellingPrice"), description: text("description"), - manufacturerNumber: text("manufacturerNumber"), + manufacturer_number: text("manufacturerNumber"), - vendorAllocation: jsonb("vendorAllocation").default([]), + vendor_allocation: jsonb("vendorAllocation").default([]), - articleNumber: text("articleNumber"), + article_number: text("articleNumber"), barcodes: text("barcodes").array().notNull().default([]), @@ -57,12 +57,12 @@ export const products = pgTable("products", { archived: boolean("archived").notNull().default(false), - taxPercentage: smallint("taxPercentage").notNull().default(19), + tax_percentage: smallint("taxPercentage").notNull().default(19), - markupPercentage: doublePrecision("markupPercentage"), + markup_percentage: doublePrecision("markupPercentage"), - updatedAt: timestamp("updated_at", { withTimezone: true }), - updatedBy: uuid("updated_by").references(() => authUsers.id), + updated_at: timestamp("updated_at", { withTimezone: true }), + updated_by: uuid("updated_by").references(() => authUsers.id), }) export type Product = typeof products.$inferSelect diff --git a/db/schema/servicecategories.ts b/db/schema/servicecategories.ts index e51b03a..f0364b5 100644 --- a/db/schema/servicecategories.ts +++ b/db/schema/servicecategories.ts @@ -16,7 +16,7 @@ export const servicecategories = pgTable("servicecategories", { .primaryKey() .generatedByDefaultAsIdentity(), - createdAt: timestamp("created_at", { withTimezone: true }) + created_at: timestamp("created_at", { withTimezone: true }) .notNull() .defaultNow(), @@ -31,8 +31,8 @@ export const servicecategories = pgTable("servicecategories", { archived: boolean("archived").notNull().default(false), - updatedAt: timestamp("updated_at", { withTimezone: true }), - updatedBy: uuid("updated_by").references(() => authUsers.id), + updated_at: timestamp("updated_at", { withTimezone: true }), + updated_by: uuid("updated_by").references(() => authUsers.id), }) export type ServiceCategory = typeof servicecategories.$inferSelect diff --git a/db/schema/spaces.ts b/db/schema/spaces.ts index b0d8116..7b8ce0d 100644 --- a/db/schema/spaces.ts +++ b/db/schema/spaces.ts @@ -27,13 +27,13 @@ export const spaces = pgTable("spaces", { .notNull() .references(() => tenants.id), - spaceNumber: text("spaceNumber").notNull(), + space_number: text("spaceNumber").notNull(), parentSpace: bigint("parentSpace", { mode: "number" }).references( () => spaces.id ), - infoData: jsonb("infoData") + info_data: jsonb("infoData") .notNull() .default({ zip: "", city: "", streetNumber: "" }), diff --git a/db/schema/vehicles.ts b/db/schema/vehicles.ts index 7915657..30a6553 100644 --- a/db/schema/vehicles.ts +++ b/db/schema/vehicles.ts @@ -17,7 +17,7 @@ export const vehicles = pgTable("vehicles", { .primaryKey() .generatedByDefaultAsIdentity(), - createdAt: timestamp("created_at", { withTimezone: true }) + created_at: timestamp("created_at", { withTimezone: true }) .notNull() .defaultNow(), @@ -25,7 +25,7 @@ export const vehicles = pgTable("vehicles", { .notNull() .references(() => tenants.id), - licensePlate: text("licensePlate"), + license_plate: text("licensePlate"), name: text("name"), type: text("type"), @@ -36,21 +36,21 @@ export const vehicles = pgTable("vehicles", { vin: text("vin"), - tankSize: doublePrecision("tankSize").notNull().default(0), + tank_size: doublePrecision("tankSize").notNull().default(0), archived: boolean("archived").notNull().default(false), - buildYear: text("buildYear"), + build_year: text("buildYear"), - towingCapacity: bigint("towingCapacity", { mode: "number" }), - powerInKW: bigint("powerInKW", { mode: "number" }), + towing_capacity: bigint("towingCapacity", { mode: "number" }), + power_in_kw: bigint("powerInKW", { mode: "number" }), color: text("color"), profiles: jsonb("profiles").notNull().default([]), - updatedAt: timestamp("updated_at", { withTimezone: true }), - updatedBy: uuid("updated_by").references(() => authUsers.id), + updated_at: timestamp("updated_at", { withTimezone: true }), + updated_by: uuid("updated_by").references(() => authUsers.id), }) export type Vehicle = typeof vehicles.$inferSelect