mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-05 18:26:45 -05:00
fixes to schema file psa
This commit is contained in:
@@ -1,10 +1,36 @@
|
||||
// Dont think this is need with the Drizzle schema
|
||||
|
||||
// import { pgTable, text, decimal, serial, integer } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, integer, varchar, text, decimal, real } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
|
||||
// export const psa = pgTable('psa', {
|
||||
// id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "brands_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
// category: text('category').notNull(),
|
||||
// department: text('department').notNull(),
|
||||
// saleprice: decimal('saleprice', { precision: 10, scale: 2 }).notNull(),
|
||||
// });
|
||||
export const psa = pgTable("psa", {
|
||||
sku: varchar("SKU", { length: 50 }),
|
||||
manufacturerId: varchar("MANUFACTURER_ID", { length: 50 }),
|
||||
brandName: varchar("BRAND_NAME", { length: 50 }),
|
||||
productName: varchar("PRODUCT_NAME", { length: 255 }),
|
||||
longDescription: text("LONG_DESCRIPTION"),
|
||||
shortDescription: varchar("SHORT_DESCRIPTION", { length: 50 }),
|
||||
department: varchar("DEPARTMENT", { length: 50 }),
|
||||
category: varchar("CATEGORY", { length: 50 }),
|
||||
subcategory: varchar("SUBCATEGORY", { length: 50 }),
|
||||
thumbUrl: varchar("THUMB_URL", { length: 50 }),
|
||||
imageUrl: varchar("IMAGE_URL", { length: 50 }),
|
||||
buyLink: varchar("BUY_LINK", { length: 128 }),
|
||||
keywords: varchar("KEYWORDS", { length: 50 }),
|
||||
reviews: varchar("REVIEWS", { length: 50 }),
|
||||
retailPrice: real("RETAIL_PRICE"),
|
||||
salePrice: real("SALE_PRICE"),
|
||||
brandPageLink: varchar("BRAND_PAGE_LINK", { length: 50 }),
|
||||
brandLogoImage: varchar("BRAND_LOGO_IMAGE", { length: 50 }),
|
||||
productPageViewTracking: varchar("PRODUCT_PAGE_VIEW_TRACKING", { length: 256 }),
|
||||
parentGroupId: varchar("PARENT_GROUP_ID", { length: 50 }),
|
||||
fineline: varchar("FINELINE", { length: 50 }),
|
||||
superfineline: varchar("SUPERFINELINE", { length: 200 }),
|
||||
modelnumber: varchar("MODELNUMBER", { length: 50 }),
|
||||
caliber: varchar("CALIBER", { length: 200 }),
|
||||
upc: varchar("UPC", { length: 100 }),
|
||||
mediumImageUrl: varchar("MEDIUM_IMAGE_URL", { length: 50 }),
|
||||
productContentWidget: varchar("PRODUCT_CONTENT_WIDGET", { length: 256 }),
|
||||
googleCategorization: varchar("GOOGLE_CATEGORIZATION", { length: 50 }),
|
||||
itemBasedCommission: varchar("ITEM_BASED_COMMISSION", { length: 50 }),
|
||||
});
|
||||
@@ -1,18 +1,8 @@
|
||||
import { pgTable, integer, varchar, timestamp, text, numeric, unique, foreignKey, doublePrecision, real, bigint } from "drizzle-orm/pg-core"
|
||||
import { pgTable, integer, varchar, text, numeric, timestamp, uuid, unique, real, index, 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(),
|
||||
@@ -33,6 +23,22 @@ export const categories = pgTable("categories", {
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
});
|
||||
|
||||
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' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
productFeedsUuidUnique: unique("product_feeds_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
export const brands = pgTable("brands", {
|
||||
@@ -41,6 +47,11 @@ export const brands = pgTable("brands", {
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
brandsUuidUnique: unique("brands_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
export const manufacturer = pgTable("manufacturer", {
|
||||
@@ -49,14 +60,43 @@ export const manufacturer = pgTable("manufacturer", {
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
manufacturerUuidUnique: unique("manufacturer_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
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 psa = pgTable("psa", {
|
||||
sku: varchar("SKU", { length: 50 }),
|
||||
manufacturerId: varchar("MANUFACTURER_ID", { length: 50 }),
|
||||
brandName: varchar("BRAND_NAME", { length: 50 }),
|
||||
productName: varchar("PRODUCT_NAME", { length: 255 }),
|
||||
longDescription: text("LONG_DESCRIPTION"),
|
||||
shortDescription: varchar("SHORT_DESCRIPTION", { length: 50 }),
|
||||
department: varchar("DEPARTMENT", { length: 50 }),
|
||||
category: varchar("CATEGORY", { length: 50 }),
|
||||
subcategory: varchar("SUBCATEGORY", { length: 50 }),
|
||||
thumbUrl: varchar("THUMB_URL", { length: 50 }),
|
||||
imageUrl: varchar("IMAGE_URL", { length: 50 }),
|
||||
buyLink: varchar("BUY_LINK", { length: 128 }),
|
||||
keywords: varchar("KEYWORDS", { length: 50 }),
|
||||
reviews: varchar("REVIEWS", { length: 50 }),
|
||||
retailPrice: real("RETAIL_PRICE"),
|
||||
salePrice: real("SALE_PRICE"),
|
||||
brandPageLink: varchar("BRAND_PAGE_LINK", { length: 50 }),
|
||||
brandLogoImage: varchar("BRAND_LOGO_IMAGE", { length: 50 }),
|
||||
productPageViewTracking: varchar("PRODUCT_PAGE_VIEW_TRACKING", { length: 256 }),
|
||||
parentGroupId: varchar("PARENT_GROUP_ID", { length: 50 }),
|
||||
fineline: varchar("FINELINE", { length: 50 }),
|
||||
superfineline: varchar("SUPERFINELINE", { length: 200 }),
|
||||
modelnumber: varchar("MODELNUMBER", { length: 50 }),
|
||||
caliber: varchar("CALIBER", { length: 200 }),
|
||||
upc: varchar("UPC", { length: 100 }),
|
||||
mediumImageUrl: varchar("MEDIUM_IMAGE_URL", { length: 50 }),
|
||||
productContentWidget: varchar("PRODUCT_CONTENT_WIDGET", { length: 256 }),
|
||||
googleCategorization: varchar("GOOGLE_CATEGORIZATION", { length: 50 }),
|
||||
itemBasedCommission: varchar("ITEM_BASED_COMMISSION", { length: 50 }),
|
||||
});
|
||||
|
||||
export const states = pgTable("states", {
|
||||
@@ -65,27 +105,23 @@ export const states = pgTable("states", {
|
||||
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 }),
|
||||
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' }),
|
||||
email: varchar({ length: 100 }),
|
||||
username: varchar({ length: 50 }).notNull(),
|
||||
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
balAccountsUsernameUnique: unique("bal_accounts_username_unique").on(table.username),
|
||||
balAccountsPasswordHashUnique: unique("bal_accounts_password_hash_unique").on(table.passwordHash),
|
||||
componentTypeUuidUnique: unique("component_type_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
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(),
|
||||
export const compartment = pgTable("compartment", {
|
||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
description: varchar({ length: 300 }),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
@@ -99,13 +135,31 @@ export const builds = pgTable("builds", {
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
buildsBalAccountsFk: foreignKey({
|
||||
columns: [table.accountId],
|
||||
foreignColumns: [balAccounts.id],
|
||||
name: "builds_bal_accounts_fk"
|
||||
}),
|
||||
idIdx: index("builds_id_idx").using("btree", table.id.asc().nullsLast().op("int4_ops")),
|
||||
uuidIdx: index("builds_uuid_idx").using("btree", table.uuid.asc().nullsLast().op("uuid_ops")),
|
||||
buildsUuidUnique: unique("builds_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
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(),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
balAccountsUsernameUnique: unique("bal_accounts_username_unique").on(table.username),
|
||||
balAccountsPasswordHashUnique: unique("bal_accounts_password_hash_unique").on(table.passwordHash),
|
||||
balAccountsUuidUnique: unique("bal_accounts_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
@@ -193,6 +247,20 @@ export const lipseycatalog = pgTable("lipseycatalog", {
|
||||
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' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
buildsComponentsUuidUnique: unique("builds_components_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
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(),
|
||||
@@ -201,36 +269,9 @@ export const balResellers = pgTable("bal_resellers", {
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
}, (table) => {
|
||||
return {
|
||||
balResellersUuidUnique: unique("bal_resellers_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
|
||||
export const psa = pgTable("psa", {
|
||||
sku: varchar({ length: 255 }),
|
||||
manufacturerId: varchar("Manufacturer_Id", { length: 255 }),
|
||||
brandName: varchar("Brand_Name", { length: 255 }),
|
||||
productName: varchar("Product_Name", { length: 256 }),
|
||||
longDescription: text("Long_Description"),
|
||||
shortDescription: varchar("Short_Description", { length: 255 }),
|
||||
department: varchar({ length: 255 }),
|
||||
category: varchar({ length: 255 }),
|
||||
subcategory: varchar({ length: 255 }),
|
||||
thumbUrl: varchar("Thumb_URL", { length: 255 }),
|
||||
imageUrl: varchar("Image_URL", { length: 255 }),
|
||||
buyLink: varchar("Buy_Link", { length: 255 }),
|
||||
keywords: varchar({ length: 255 }),
|
||||
reviews: varchar({ length: 255 }),
|
||||
retailPrice: real("Retail_Price"),
|
||||
salePrice: real("Sale_Price"),
|
||||
brandPageLink: varchar("Brand_Page_Link", { length: 255 }),
|
||||
brandLogoImage: varchar("Brand_Logo_Image", { length: 255 }),
|
||||
productPageViewTracking: varchar("Product_Page_View_Tracking", { length: 256 }),
|
||||
parentGroupId: varchar("Parent_Group_ID", { length: 255 }),
|
||||
fineline: varchar({ length: 255 }),
|
||||
superfineline: varchar({ length: 255 }),
|
||||
modelnumber: varchar({ length: 255 }),
|
||||
caliber: varchar({ length: 255 }),
|
||||
// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
||||
upc: bigint({ mode: "number" }),
|
||||
mediumImageUrl: varchar("Medium_Image_URL", { length: 255 }),
|
||||
googleCategorization: varchar("Google_Categorization", { length: 255 }),
|
||||
itemBasedCommission: varchar("Item_Based_Commission", { length: 255 }),
|
||||
});
|
||||
@@ -21,13 +21,13 @@
|
||||
],
|
||||
"paths": {
|
||||
"@src/*": [
|
||||
"/src/*"],
|
||||
"./src/*"],
|
||||
"@/db/*": [
|
||||
"./src/db/*"],
|
||||
"@db/*": [
|
||||
"./src/db/*"],
|
||||
"@types/*": [
|
||||
"/src/types/*"],
|
||||
"./src/types/*"],
|
||||
"@components/*": [
|
||||
"./src/components/*",
|
||||
"./src/components/ui/*",
|
||||
|
||||
Reference in New Issue
Block a user