mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
changing plurals to single and proper-casing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'dotenv/config';
|
||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||
import { drizzle } from 'drizzle-orm';
|
||||
import { Pool } from 'pg';
|
||||
import { sql } from 'drizzle-orm';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// db/queries.ts
|
||||
import { accounts } from '../schema/accounts'
|
||||
import { accounts } from '../schema/Account'
|
||||
import { db } from '../index';
|
||||
|
||||
// Fetch all accounts
|
||||
@@ -9,15 +9,15 @@ export async function getAllAccounts() {
|
||||
|
||||
// Add a new accounts
|
||||
export async function addAcounts(name: string) {
|
||||
return await db.insertInto(User).values({ name }).returning();
|
||||
return await db.insertInto(accounts).values({ name }).returning();
|
||||
}
|
||||
|
||||
// Update a user
|
||||
export async function updateUser(id: number, name: string) {
|
||||
return await db.update(User).set({ name }).where(User.id.equals(id));
|
||||
// Update a accounts
|
||||
export async function updateAcounts(id: number, name: string) {
|
||||
return await db.update(accounts).set({ name }).where(accounts.id.equals(id));
|
||||
}
|
||||
|
||||
// Delete a user
|
||||
export async function deleteUser(id: number) {
|
||||
return await db.deleteFrom(User).where(User.id.equals(id));
|
||||
// Delete a accounts
|
||||
export async function deleteAccount(id: number) {
|
||||
return await db.deleteFrom(accounts).where(accounts.id.equals(id));
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { pgTable, integer, varchar } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./columns.helpers";
|
||||
|
||||
export const accounts = pgTable("bal_accounts", {
|
||||
export const Account = pgTable("bal_accounts", {
|
||||
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 }),
|
||||
@@ -2,7 +2,7 @@ import { pgTable, integer, varchar } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./columns.helpers";
|
||||
|
||||
export const categories = pgTable("categories", {
|
||||
export const Category = 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(),
|
||||
@@ -3,7 +3,7 @@ import { sql } from "drizzle-orm"
|
||||
import { timestamps } from "./columns.helpers";
|
||||
|
||||
|
||||
export const lipseycatalog = pgTable("lipseycatalog", {
|
||||
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(),
|
||||
@@ -2,7 +2,7 @@ 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", {
|
||||
export const Product = 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(),
|
||||
@@ -2,7 +2,7 @@ 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", {
|
||||
export const Product_feed = 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(),
|
||||
@@ -2,7 +2,7 @@ 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", {
|
||||
export const Reseller = 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 }),
|
||||
@@ -1,3 +1,3 @@
|
||||
import { relations } from "drizzle-orm/relations";
|
||||
import { } from "./lipseyCatalog";
|
||||
import { } from "./LipseyCatalog";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user