mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
auth aint working, trying new version
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { pgTable, integer, varchar, text, numeric, timestamp, unique, check, bigserial, date, boolean, uuid, bigint, real, doublePrecision, primaryKey, foreignKey } from "drizzle-orm/pg-core"
|
||||
import { pgTable, integer, varchar, text, numeric, timestamp, unique, check, bigserial, date, boolean, uuid, bigint, real, doublePrecision, primaryKey } from "drizzle-orm/pg-core"
|
||||
import { sql } from "drizzle-orm"
|
||||
|
||||
|
||||
@@ -17,6 +17,16 @@ export const products = pgTable("products", {
|
||||
});
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: text("id")
|
||||
.primaryKey()
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
name: text("name"),
|
||||
email: text("email").unique(),
|
||||
emailVerified: timestamp("emailVerified", { mode: "date" }),
|
||||
image: text("image"),
|
||||
})
|
||||
|
||||
export const userskeep = pgTable("users-keep", {
|
||||
id: bigserial({ mode: "bigint" }).primaryKey().notNull(),
|
||||
username: varchar({ length: 50 }).notNull(),
|
||||
email: varchar({ length: 255 }).notNull(),
|
||||
@@ -66,18 +76,6 @@ export const productFeeds = pgTable("product_feeds", {
|
||||
}
|
||||
});
|
||||
|
||||
export const user = pgTable("user", {
|
||||
id: text().primaryKey().notNull(),
|
||||
name: text(),
|
||||
email: text(),
|
||||
emailVerified: timestamp({ mode: 'string' }),
|
||||
image: text(),
|
||||
}, (table) => {
|
||||
return {
|
||||
userEmailUnique: unique("user_email_unique").on(table.email),
|
||||
}
|
||||
});
|
||||
|
||||
export const userActivityLog = pgTable("user_activity_log", {
|
||||
// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
||||
id: bigint({ mode: "number" }).primaryKey().generatedAlwaysAsIdentity({ name: "user_activity_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
@@ -100,6 +98,12 @@ export const brands = pgTable("brands", {
|
||||
}
|
||||
});
|
||||
|
||||
export const sessions = pgTable("sessions", {
|
||||
sessionToken: text().primaryKey().notNull(),
|
||||
userId: text().notNull(),
|
||||
expires: timestamp({ mode: 'string' }).notNull(),
|
||||
});
|
||||
|
||||
export const manufacturer = pgTable("manufacturer", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "manufacturer_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
@@ -113,12 +117,6 @@ export const manufacturer = pgTable("manufacturer", {
|
||||
}
|
||||
});
|
||||
|
||||
export const session = pgTable("session", {
|
||||
sessionToken: text().primaryKey().notNull(),
|
||||
userId: text().notNull(),
|
||||
expires: timestamp({ mode: 'string' }).notNull(),
|
||||
});
|
||||
|
||||
export const states = pgTable("states", {
|
||||
id: integer().primaryKey().generatedByDefaultAsIdentity({ name: "states_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
state: varchar({ length: 50 }),
|
||||
@@ -336,7 +334,7 @@ export const balResellers = pgTable("bal_resellers", {
|
||||
}
|
||||
});
|
||||
|
||||
export const verificationToken = pgTable("verificationToken", {
|
||||
export const verificationTokens = pgTable("verificationTokens", {
|
||||
identifier: text().notNull(),
|
||||
token: text().notNull(),
|
||||
expires: timestamp({ mode: 'string' }).notNull(),
|
||||
@@ -357,17 +355,12 @@ export const authenticator = pgTable("authenticator", {
|
||||
transports: text(),
|
||||
}, (table) => {
|
||||
return {
|
||||
authenticatorUserIdUserIdFk: foreignKey({
|
||||
columns: [table.userId],
|
||||
foreignColumns: [user.id],
|
||||
name: "authenticator_userId_user_id_fk"
|
||||
}).onDelete("cascade"),
|
||||
authenticatorUserIdCredentialIdPk: primaryKey({ columns: [table.credentialId, table.userId], name: "authenticator_userId_credentialID_pk"}),
|
||||
authenticatorCredentialIdUnique: unique("authenticator_credentialID_unique").on(table.credentialId),
|
||||
}
|
||||
});
|
||||
|
||||
export const account = pgTable("account", {
|
||||
export const accounts = pgTable("accounts", {
|
||||
userId: text().notNull(),
|
||||
type: text().notNull(),
|
||||
provider: text().notNull(),
|
||||
|
||||
Reference in New Issue
Block a user