mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
moved schema to a single file
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { db } from '../../index';
|
||||
import { psa } from '@schemas/Psa';
|
||||
import { psa } from '@schemas/schema';
|
||||
import { eq, lt, gte, ne, and, like } from 'drizzle-orm';
|
||||
import CATEGORY from '@src/data/parts_cats.json';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { users } from "@schemas/User";
|
||||
import { users } from "@schemas/schema";
|
||||
import { integer, pgTable, primaryKey, text } from "drizzle-orm/pg-core";
|
||||
import type { AdapterAccountType } from "next-auth/adapters"
|
||||
export const accounts = pgTable(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { boolean, integer, pgTable, primaryKey, text } from "drizzle-orm/pg-core";
|
||||
import { users } from '@schemas/User'
|
||||
import { users } from '@schemas/schema'
|
||||
export const authenticators = pgTable(
|
||||
"authenticator",
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, uuid } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const brand = pgTable("brands", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "brands_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, text, uuid } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const Build = pgTable("builds", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, text, uuid } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const BuildComponent = pgTable("builds_components", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_components_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, uuid } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const Category = pgTable("categories", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "categories_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, text,uuid} from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const compartment = pgTable("compartment", {
|
||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, uuid} from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
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 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, text, doublePrecision, timestamp } from "drizzle-orm/pg-core"
|
||||
import { sql } from "drizzle-orm"
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
|
||||
export const LipseyCatalog = pgTable("lipseycatalog", {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, uuid} from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const manufacturer = pgTable("manufacturer", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "manufacturer_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, text, decimal } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const Product = pgTable("products", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "products_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, timestamp, uuid } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
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 }),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import { pgTable, integer, varchar, text, decimal, uuid, real } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const psa = pgTable("psa", {
|
||||
sku: varchar("SKU", { length: 50 }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, integer, varchar, uuid } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
import { timestamps } from "../../drizzle/schema/helpers/columns.helpers";
|
||||
|
||||
export const Reseller = pgTable("bal_resellers", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "resellers_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
||||
import {User} from '@schemas/User';
|
||||
import {user} from '@schemas/schema';
|
||||
export const sessions = pgTable("session", {
|
||||
sessionToken: text("sessionToken").primaryKey(),
|
||||
userId: text("userId")
|
||||
.notNull()
|
||||
.references(() => User.id, { onDelete: "cascade" }),
|
||||
.references(() => user.id, { onDelete: "cascade" }),
|
||||
expires: timestamp("expires", { mode: "date" }).notNull(),
|
||||
})
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { timestamp } from "drizzle-orm/pg-core";
|
||||
|
||||
// columns.helpers.ts
|
||||
export const timestamps = {
|
||||
updated_at: timestamp().defaultNow().notNull(),
|
||||
created_at: timestamp().defaultNow().notNull(),
|
||||
deleted_at: timestamp(),
|
||||
}
|
||||
|
||||
export const timestampsAllowNulls = {
|
||||
updated_at: timestamp().defaultNow(),
|
||||
created_at: timestamp().defaultNow(),
|
||||
deleted_at: timestamp(),
|
||||
}
|
||||
Reference in New Issue
Block a user