🐛 fix: drop user.phoneNumber and reuse user.phone (#10531)

This commit is contained in:
YuTengjing
2025-12-01 19:00:29 +08:00
committed by GitHub
parent f0e05b4868
commit 2ab88c5dcf
6 changed files with 8420 additions and 4 deletions
+1 -2
View File
@@ -1044,7 +1044,7 @@ table users {
username text [unique]
email text [unique]
avatar text
phone text
phone text [unique]
first_name text
last_name text
full_name text
@@ -1058,7 +1058,6 @@ table users {
ban_reason text
ban_expires "timestamp with time zone"
two_factor_enabled boolean [default: false]
phone_number text [unique]
phone_number_verified boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
@@ -0,0 +1,4 @@
ALTER TABLE "users" DROP CONSTRAINT IF EXISTS "users_phone_number_unique";--> statement-breakpoint
ALTER TABLE "users" DROP COLUMN IF EXISTS "phone_number";--> statement-breakpoint
ALTER TABLE "users" DROP CONSTRAINT IF EXISTS "users_phone_unique";--> statement-breakpoint
ALTER TABLE "users" ADD CONSTRAINT "users_phone_unique" UNIQUE("phone");
File diff suppressed because it is too large Load Diff
@@ -385,6 +385,13 @@
"when": 1764579351312,
"tag": "0054_better_auth_two_factor",
"breakpoints": true
},
{
"idx": 55,
"version": "7",
"when": 1764583392443,
"tag": "0055_rename_phone_number_to_phone",
"breakpoints": true
}
],
"version": "6"
@@ -890,5 +890,16 @@
"bps": true,
"folderMillis": 1764579351312,
"hash": "22fb7a65764b1f3e3c1ae2ce95d448685e6a01d1fb2f8c3f925c655f0824c161"
},
{
"sql": [
"ALTER TABLE \"users\" DROP CONSTRAINT IF EXISTS \"users_phone_number_unique\";",
"\nALTER TABLE \"users\" DROP COLUMN IF EXISTS \"phone_number\";",
"\nALTER TABLE \"users\" DROP CONSTRAINT IF EXISTS \"users_phone_unique\";",
"\nALTER TABLE \"users\" ADD CONSTRAINT \"users_phone_unique\" UNIQUE(\"phone\");\n"
],
"bps": true,
"folderMillis": 1764583392443,
"hash": "6a43d90ee1d2e1e008d1b8206f227aa05b9a2e2a8fc8c31ec608a3716c716a6c"
}
]
+1 -2
View File
@@ -12,7 +12,7 @@ export const users = pgTable('users', {
email: text('email').unique(),
avatar: text('avatar'),
phone: text('phone'),
phone: text('phone').unique(),
firstName: text('first_name'),
lastName: text('last_name'),
fullName: text('full_name'),
@@ -38,7 +38,6 @@ export const users = pgTable('users', {
twoFactorEnabled: boolean('two_factor_enabled').default(false),
// better-auth phone number
phoneNumber: text('phone_number').unique(),
phoneNumberVerified: boolean('phone_number_verified'),
...timestamps,