fixes, nested the NextLink, it works, removed prisma

This commit is contained in:
2024-11-26 11:58:39 -05:00
parent 608705772e
commit 2454b1dc14
8 changed files with 51 additions and 181 deletions

View File

@@ -1,6 +1,8 @@
import { pgTable, integer, varchar, timestamp, text, numeric, unique, doublePrecision } from "drizzle-orm/pg-core"
import { pgTable, integer, varchar, timestamp, text, numeric, unique, foreignKey, 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(),
@@ -49,13 +51,6 @@ export const manufacturer = pgTable("manufacturer", {
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(),
@@ -80,13 +75,22 @@ export const balAccounts = pgTable("bal_accounts", {
email: varchar({ length: 100 }),
username: varchar({ length: 50 }).notNull(),
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
}, (table) => {
}, (self) => {
return {
balAccountsUsernameUnique: unique("bal_accounts_username_unique").on(table.username),
balAccountsPasswordHashUnique: unique("bal_accounts_password_hash_unique").on(table.passwordHash),
}
});
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 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(),
@@ -95,15 +99,14 @@ 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' }),
});
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' }),
}, (table) => {
return {
buildsBalAccountsFk: foreignKey({
columns: [table.accountId],
foreignColumns: [balAccounts.id],
name: "builds_bal_accounts_fk"
}),
}
});
export const lipseycatalog = pgTable("lipseycatalog", {