diff --git a/package-lock.json b/package-lock.json index bad3871..73bb39d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4093,6 +4093,7 @@ "version": "0.36.3", "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.36.3.tgz", "integrity": "sha512-ffQB7CcyCTvQBK6xtRLMl/Jsd5xFTBs+UTHrgs1hbk68i5TPkbsoCPbKEwiEsQZfq2I7VH632XJpV1g7LS2H9Q==", + "license": "Apache-2.0", "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=3", diff --git a/src/db/schema/accounts.ts b/src/db/schema/accounts.ts index f0e9012..77141f2 100644 --- a/src/db/schema/accounts.ts +++ b/src/db/schema/accounts.ts @@ -3,9 +3,12 @@ import { sql } from "drizzle-orm"; import { timestamps } from "./columns.helpers"; export const accounts = pgTable("bal_accounts", { - id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "accountsid_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "accounts_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), first_name: varchar({ length: 40 }), last_name: varchar({ length: 40 }), email: varchar({length: 100}), + username: varchar({length:50}).notNull().unique(), + password_hash: varchar({length:255}).notNull().unique(), + ...timestamps }) \ No newline at end of file diff --git a/src/db/schema/baseTable.ts b/src/db/schema/baseTable.ts new file mode 100644 index 0000000..9387682 --- /dev/null +++ b/src/db/schema/baseTable.ts @@ -0,0 +1,9 @@ +import { pgTable, integer, varchar } from "drizzle-orm/pg-core"; +import { sql } from "drizzle-orm"; +import { timestamps } from "./columns.helpers"; + +export const accounts = pgTable("base_table", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "base_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + + ...timestamps +}) \ No newline at end of file diff --git a/src/db/schema/categories.ts b/src/db/schema/categories.ts new file mode 100644 index 0000000..81d0184 --- /dev/null +++ b/src/db/schema/categories.ts @@ -0,0 +1,10 @@ +import { pgTable, integer, varchar } from "drizzle-orm/pg-core"; +import { sql } from "drizzle-orm"; +import { timestamps } from "./columns.helpers"; + +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(), + parent_category_id: integer(), + ...timestamps +}) \ No newline at end of file diff --git a/src/db/schema/lipseyCatalog.ts b/src/db/schema/lipseyCatalog.ts index aa374df..916305c 100644 --- a/src/db/schema/lipseyCatalog.ts +++ b/src/db/schema/lipseyCatalog.ts @@ -85,4 +85,4 @@ export const lipseycatalog = pgTable("lipseycatalog", { ...timestamps }); -; + diff --git a/src/db/schema/product_feeds.ts b/src/db/schema/product_feeds.ts new file mode 100644 index 0000000..de10cba --- /dev/null +++ b/src/db/schema/product_feeds.ts @@ -0,0 +1,11 @@ +import { pgTable, integer, varchar, timestamp } from "drizzle-orm/pg-core"; +import { sql } from "drizzle-orm"; +import { timestamps } from "./columns.helpers"; + +export const product_feeds = pgTable("product_feeds", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "productfeeds_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + reseller_id: integer().notNull(), + feed_url: varchar({ length:255 }).notNull(), + last_update: timestamp(), + ...timestamps +}) \ No newline at end of file diff --git a/src/db/schema/products.ts b/src/db/schema/products.ts new file mode 100644 index 0000000..ea8537b --- /dev/null +++ b/src/db/schema/products.ts @@ -0,0 +1,14 @@ +import { pgTable, integer, varchar, text, decimal } from "drizzle-orm/pg-core"; +import { sql } from "drizzle-orm"; +import { timestamps } from "./columns.helpers"; + +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: decimal().notNull(), + reseller_id: integer().notNull(), + category_id: integer().notNull(), + stock_qty: integer().default(0), + ...timestamps +}) \ No newline at end of file diff --git a/src/db/schema/retailers.ts b/src/db/schema/retailers.ts new file mode 100644 index 0000000..cf7a770 --- /dev/null +++ b/src/db/schema/retailers.ts @@ -0,0 +1,11 @@ +import { pgTable, integer, varchar } from "drizzle-orm/pg-core"; +import { sql } from "drizzle-orm"; +import { timestamps } from "./columns.helpers"; + +export const resellers = 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(), + website_url: varchar({ length: 255 }), + contact_email: varchar({length: 100}), + ...timestamps +}) \ No newline at end of file