mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
fixes, nested the NextLink, it works, removed prisma
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
import { relations } from "drizzle-orm/relations";
|
||||
import { } from "./schema";
|
||||
import { balAccounts, builds } from "./schema";
|
||||
|
||||
export const buildsRelations = relations(builds, ({one}) => ({
|
||||
balAccount: one(balAccounts, {
|
||||
fields: [builds.accountId],
|
||||
references: [balAccounts.id]
|
||||
}),
|
||||
}));
|
||||
|
||||
export const balAccountsRelations = relations(balAccounts, ({many}) => ({
|
||||
builds: many(builds),
|
||||
}));
|
||||
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user