adding userRegistrationForm and updating users table

This commit is contained in:
2025-01-14 16:59:47 -05:00
parent 85fdf25917
commit f8b8f7c819
10 changed files with 211 additions and 141 deletions

View File

@@ -23,6 +23,7 @@ export const users = pgTable("users", {
name: text("name"),
email: text("email").unique(),
emailVerified: timestamp("emailVerified", { mode: "date" }),
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
image: text("image"),
})
@@ -30,6 +31,7 @@ export const userskeep = pgTable("users-keep", {
id: bigserial({ mode: "bigint" }).primaryKey().notNull(),
username: varchar({ length: 50 }).notNull(),
email: varchar({ length: 255 }).notNull(),
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
firstName: varchar("first_name", { length: 50 }),
lastName: varchar("last_name", { length: 50 }),
@@ -50,6 +52,33 @@ export const userskeep = pgTable("users-keep", {
usersBuildPrivacySettingCheck: check("users_build_privacy_setting_check", sql`build_privacy_setting = ANY (ARRAY['private'::text, 'public'::text])`),
}
});
export const usersMerged = pgTable("users-merged", {
id: text("id")
.primaryKey()
.$defaultFn(() => crypto.randomUUID()),
username: varchar({ length: 50 }).notNull(),
email: varchar({ length: 255 }).notNull(),
emailVerifiedOn: timestamp("emailVerified", { mode: "date" }),
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
firstName: varchar("first_name", { length: 50 }),
lastName: varchar("last_name", { length: 50 }),
profilePicture: varchar("profile_picture", { length: 255 }),
dateOfBirth: date("date_of_birth"),
phoneNumber: varchar("phone_number", { length: 20 }),
createdAt: timestamp("created_at", { mode: 'string' }).default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp("updated_at", { mode: 'string' }).default(sql`CURRENT_TIMESTAMP`),
isAdmin: boolean("is_admin").default(false),
lastLogin: timestamp("last_login", { mode: 'string' }),
emailVerified: boolean("email_verified").default(false),
buildPrivacySetting: text("build_privacy_setting").default('public'),
uuid: uuid().defaultRandom(),
}, (table) => {
return {
usersUsernameKey: unique("users-merged_username_key").on(table.username),
usersEmailKey: unique("users-merged_email_key").on(table.email),
usersBuildPrivacySettingCheck: check("users-merged_build_privacy_setting_check", sql`build_privacy_setting = ANY (ARRAY['private'::text, 'public'::text])`),
}
});
export const categories = pgTable("categories", {
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "categories_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),