db changes

This commit is contained in:
2025-12-07 17:11:26 +01:00
parent 0f3c8c862f
commit 76e40cd9e1
6 changed files with 27 additions and 27 deletions

View File

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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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