mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
committing wiht errors wbut better than before, moved some stuff more moving coming,
This commit is contained in:
3
src/drizzle/relations.ts
Normal file
3
src/drizzle/relations.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { relations } from "drizzle-orm/relations";
|
||||
import { } from "./schema";
|
||||
|
||||
203
src/drizzle/schema.ts
Normal file
203
src/drizzle/schema.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
import { pgTable, integer, varchar, timestamp, text, numeric, unique, doublePrecision } from "drizzle-orm/pg-core"
|
||||
import { sql } from "drizzle-orm"
|
||||
|
||||
|
||||
|
||||
export const productFeeds = pgTable("product_feeds", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "productfeeds_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
resellerId: integer("reseller_id").notNull(),
|
||||
feedUrl: varchar("feed_url", { length: 255 }).notNull(),
|
||||
lastUpdate: timestamp("last_update", { mode: 'string' }),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const products = pgTable("products", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "products_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 255 }).notNull(),
|
||||
description: text().notNull(),
|
||||
price: numeric().notNull(),
|
||||
resellerId: integer("reseller_id").notNull(),
|
||||
categoryId: integer("category_id").notNull(),
|
||||
stockQty: integer("stock_qty").default(0),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const categories = pgTable("categories", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "categories_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
parentCategoryId: integer("parent_category_id"),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const brands = pgTable("brands", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "brands_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const manufacturer = pgTable("manufacturer", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "manufacturer_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const baseTable = pgTable("base_table", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "base_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const componentType = pgTable("component_type", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "component_type_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const states = pgTable("states", {
|
||||
id: integer().primaryKey().generatedByDefaultAsIdentity({ name: "states_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
state: varchar({ length: 50 }),
|
||||
abbreviation: varchar({ length: 50 }),
|
||||
});
|
||||
|
||||
export const balAccounts = pgTable("bal_accounts", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "accountsid_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
firstName: varchar("first_name", { length: 40 }),
|
||||
lastName: varchar("last_name", { length: 40 }),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
email: varchar({ length: 100 }),
|
||||
username: varchar({ length: 50 }).notNull(),
|
||||
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
|
||||
}, (table) => {
|
||||
return {
|
||||
balAccountsUsernameUnique: unique("bal_accounts_username_unique").on(table.username),
|
||||
balAccountsPasswordHashUnique: unique("bal_accounts_password_hash_unique").on(table.passwordHash),
|
||||
}
|
||||
});
|
||||
|
||||
export const builds = pgTable("builds", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
accountId: integer("account_id").notNull(),
|
||||
name: varchar({ length: 255 }).notNull(),
|
||||
description: text(),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const buildsComponents = pgTable("builds_components", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_components_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
buildId: integer("build_id").notNull(),
|
||||
productId: integer("product_id").notNull(),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const lipseycatalog = pgTable("lipseycatalog", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "lipseycatalog_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
itemno: varchar({ length: 20 }).notNull(),
|
||||
description1: text(),
|
||||
description2: text(),
|
||||
upc: varchar({ length: 20 }),
|
||||
manufacturermodelno: varchar({ length: 30 }),
|
||||
msrp: doublePrecision(),
|
||||
model: text(),
|
||||
calibergauge: text(),
|
||||
manufacturer: text(),
|
||||
type: text(),
|
||||
action: text(),
|
||||
barrellength: text(),
|
||||
capacity: text(),
|
||||
finish: text(),
|
||||
overalllength: text(),
|
||||
receiver: text(),
|
||||
safety: text(),
|
||||
sights: text(),
|
||||
stockframegrips: text(),
|
||||
magazine: text(),
|
||||
weight: text(),
|
||||
imagename: text(),
|
||||
chamber: text(),
|
||||
drilledandtapped: text(),
|
||||
rateoftwist: text(),
|
||||
itemtype: text(),
|
||||
additionalfeature1: text(),
|
||||
additionalfeature2: text(),
|
||||
additionalfeature3: text(),
|
||||
shippingweight: text(),
|
||||
boundbookmanufacturer: text(),
|
||||
boundbookmodel: text(),
|
||||
boundbooktype: text(),
|
||||
nfathreadpattern: text(),
|
||||
nfaattachmentmethod: text(),
|
||||
nfabaffletype: text(),
|
||||
silencercanbedisassembled: text(),
|
||||
silencerconstructionmaterial: text(),
|
||||
nfadbreduction: text(),
|
||||
silenceroutsidediameter: text(),
|
||||
nfaform3Caliber: text(),
|
||||
opticmagnification: text(),
|
||||
maintubesize: text(),
|
||||
adjustableobjective: text(),
|
||||
objectivesize: text(),
|
||||
opticadjustments: text(),
|
||||
illuminatedreticle: text(),
|
||||
reticle: text(),
|
||||
exclusive: text(),
|
||||
quantity: varchar({ length: 10 }).default(sql`NULL`),
|
||||
allocated: text(),
|
||||
onsale: text(),
|
||||
price: doublePrecision(),
|
||||
currentprice: doublePrecision(),
|
||||
retailmap: doublePrecision(),
|
||||
fflrequired: text(),
|
||||
sotrequired: text(),
|
||||
exclusivetype: text(),
|
||||
scopecoverincluded: text(),
|
||||
special: text(),
|
||||
sightstype: text(),
|
||||
case: text(),
|
||||
choke: text(),
|
||||
dbreduction: text(),
|
||||
family: text(),
|
||||
finishtype: text(),
|
||||
frame: text(),
|
||||
griptype: varchar({ length: 30 }),
|
||||
handgunslidematerial: text(),
|
||||
countryoforigin: varchar({ length: 4 }),
|
||||
itemlength: text(),
|
||||
itemwidth: text(),
|
||||
itemheight: text(),
|
||||
packagelength: doublePrecision(),
|
||||
packagewidth: doublePrecision(),
|
||||
packageheight: doublePrecision(),
|
||||
itemgroup: varchar({ length: 40 }),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
export const balResellers = pgTable("bal_resellers", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "resellers_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
websiteUrl: varchar("website_url", { length: 255 }),
|
||||
contactEmail: varchar("contact_email", { length: 100 }),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
Reference in New Issue
Block a user