db changes
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
|||||||
} from "drizzle-orm/pg-core"
|
} from "drizzle-orm/pg-core"
|
||||||
|
|
||||||
import { tenants } from "./tenants"
|
import { tenants } from "./tenants"
|
||||||
import { inventoryItems } from "./inventoryitems"
|
import { inventoryitems } from "./inventoryitems"
|
||||||
import { projects } from "./projects"
|
import { projects } from "./projects"
|
||||||
import { vehicles } from "./vehicles"
|
import { vehicles } from "./vehicles"
|
||||||
import { authUsers } from "./auth_users"
|
import { authUsers } from "./auth_users"
|
||||||
@@ -33,7 +33,7 @@ export const costcentres = pgTable("costcentres", {
|
|||||||
project: bigint("project", { mode: "number" }).references(() => projects.id),
|
project: bigint("project", { mode: "number" }).references(() => projects.id),
|
||||||
|
|
||||||
inventoryitem: bigint("inventoryitem", { mode: "number" }).references(
|
inventoryitem: bigint("inventoryitem", { mode: "number" }).references(
|
||||||
() => inventoryItems.id
|
() => inventoryitems.id
|
||||||
),
|
),
|
||||||
|
|
||||||
description: text("description"),
|
description: text("description"),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { vendors } from "./vendors"
|
|||||||
import { spaces } from "./spaces"
|
import { spaces } from "./spaces"
|
||||||
import { authUsers } from "./auth_users"
|
import { authUsers } from "./auth_users"
|
||||||
|
|
||||||
export const inventoryItems = pgTable("inventoryitems", {
|
export const inventoryitems = pgTable("inventoryitems", {
|
||||||
id: bigint("id", { mode: "number" })
|
id: bigint("id", { mode: "number" })
|
||||||
.primaryKey()
|
.primaryKey()
|
||||||
.generatedByDefaultAsIdentity(),
|
.generatedByDefaultAsIdentity(),
|
||||||
@@ -64,5 +64,5 @@ export const inventoryItems = pgTable("inventoryitems", {
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type InventoryItem = typeof inventoryItems.$inferSelect
|
export type InventoryItem = typeof inventoryitems.$inferSelect
|
||||||
export type NewInventoryItem = typeof inventoryItems.$inferInsert
|
export type NewInventoryItem = typeof inventoryitems.$inferInsert
|
||||||
|
|||||||
@@ -40,16 +40,16 @@ export const products = pgTable("products", {
|
|||||||
ean: text("ean"),
|
ean: text("ean"),
|
||||||
barcode: text("barcode"),
|
barcode: text("barcode"),
|
||||||
|
|
||||||
purchasePrice: doublePrecision("purchasePrice"),
|
purchase_price: doublePrecision("purchasePrice"),
|
||||||
sellingPrice: doublePrecision("sellingPrice"),
|
selling_price: doublePrecision("sellingPrice"),
|
||||||
|
|
||||||
description: text("description"),
|
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([]),
|
barcodes: text("barcodes").array().notNull().default([]),
|
||||||
|
|
||||||
@@ -57,12 +57,12 @@ export const products = pgTable("products", {
|
|||||||
|
|
||||||
archived: boolean("archived").notNull().default(false),
|
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 }),
|
updated_at: timestamp("updated_at", { withTimezone: true }),
|
||||||
updatedBy: uuid("updated_by").references(() => authUsers.id),
|
updated_by: uuid("updated_by").references(() => authUsers.id),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type Product = typeof products.$inferSelect
|
export type Product = typeof products.$inferSelect
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const servicecategories = pgTable("servicecategories", {
|
|||||||
.primaryKey()
|
.primaryKey()
|
||||||
.generatedByDefaultAsIdentity(),
|
.generatedByDefaultAsIdentity(),
|
||||||
|
|
||||||
createdAt: timestamp("created_at", { withTimezone: true })
|
created_at: timestamp("created_at", { withTimezone: true })
|
||||||
.notNull()
|
.notNull()
|
||||||
.defaultNow(),
|
.defaultNow(),
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ export const servicecategories = pgTable("servicecategories", {
|
|||||||
|
|
||||||
archived: boolean("archived").notNull().default(false),
|
archived: boolean("archived").notNull().default(false),
|
||||||
|
|
||||||
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
updated_at: timestamp("updated_at", { withTimezone: true }),
|
||||||
updatedBy: uuid("updated_by").references(() => authUsers.id),
|
updated_by: uuid("updated_by").references(() => authUsers.id),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type ServiceCategory = typeof servicecategories.$inferSelect
|
export type ServiceCategory = typeof servicecategories.$inferSelect
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ export const spaces = pgTable("spaces", {
|
|||||||
.notNull()
|
.notNull()
|
||||||
.references(() => tenants.id),
|
.references(() => tenants.id),
|
||||||
|
|
||||||
spaceNumber: text("spaceNumber").notNull(),
|
space_number: text("spaceNumber").notNull(),
|
||||||
|
|
||||||
parentSpace: bigint("parentSpace", { mode: "number" }).references(
|
parentSpace: bigint("parentSpace", { mode: "number" }).references(
|
||||||
() => spaces.id
|
() => spaces.id
|
||||||
),
|
),
|
||||||
|
|
||||||
infoData: jsonb("infoData")
|
info_data: jsonb("infoData")
|
||||||
.notNull()
|
.notNull()
|
||||||
.default({ zip: "", city: "", streetNumber: "" }),
|
.default({ zip: "", city: "", streetNumber: "" }),
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const vehicles = pgTable("vehicles", {
|
|||||||
.primaryKey()
|
.primaryKey()
|
||||||
.generatedByDefaultAsIdentity(),
|
.generatedByDefaultAsIdentity(),
|
||||||
|
|
||||||
createdAt: timestamp("created_at", { withTimezone: true })
|
created_at: timestamp("created_at", { withTimezone: true })
|
||||||
.notNull()
|
.notNull()
|
||||||
.defaultNow(),
|
.defaultNow(),
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ export const vehicles = pgTable("vehicles", {
|
|||||||
.notNull()
|
.notNull()
|
||||||
.references(() => tenants.id),
|
.references(() => tenants.id),
|
||||||
|
|
||||||
licensePlate: text("licensePlate"),
|
license_plate: text("licensePlate"),
|
||||||
name: text("name"),
|
name: text("name"),
|
||||||
type: text("type"),
|
type: text("type"),
|
||||||
|
|
||||||
@@ -36,21 +36,21 @@ export const vehicles = pgTable("vehicles", {
|
|||||||
|
|
||||||
vin: text("vin"),
|
vin: text("vin"),
|
||||||
|
|
||||||
tankSize: doublePrecision("tankSize").notNull().default(0),
|
tank_size: doublePrecision("tankSize").notNull().default(0),
|
||||||
|
|
||||||
archived: boolean("archived").notNull().default(false),
|
archived: boolean("archived").notNull().default(false),
|
||||||
|
|
||||||
buildYear: text("buildYear"),
|
build_year: text("buildYear"),
|
||||||
|
|
||||||
towingCapacity: bigint("towingCapacity", { mode: "number" }),
|
towing_capacity: bigint("towingCapacity", { mode: "number" }),
|
||||||
powerInKW: bigint("powerInKW", { mode: "number" }),
|
power_in_kw: bigint("powerInKW", { mode: "number" }),
|
||||||
|
|
||||||
color: text("color"),
|
color: text("color"),
|
||||||
|
|
||||||
profiles: jsonb("profiles").notNull().default([]),
|
profiles: jsonb("profiles").notNull().default([]),
|
||||||
|
|
||||||
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
updated_at: timestamp("updated_at", { withTimezone: true }),
|
||||||
updatedBy: uuid("updated_by").references(() => authUsers.id),
|
updated_by: uuid("updated_by").references(() => authUsers.id),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type Vehicle = typeof vehicles.$inferSelect
|
export type Vehicle = typeof vehicles.$inferSelect
|
||||||
|
|||||||
Reference in New Issue
Block a user