mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-27 22:40:38 +08:00
fix: remove 2026_03_28_050000_lowercase_existing_emails.php
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
// 统计需要转换的记录数
|
|
||||||
$count = DB::table('v2_user')
|
|
||||||
->whereNotNull('email')
|
|
||||||
->whereRaw('email != LOWER(email)')
|
|
||||||
->count();
|
|
||||||
|
|
||||||
if ($count > 0) {
|
|
||||||
Log::info("Converting {$count} email(s) to lowercase");
|
|
||||||
DB::table('v2_user')
|
|
||||||
->whereNotNull('email')
|
|
||||||
->whereRaw('email != LOWER(email)')
|
|
||||||
->update(['email' => DB::raw('LOWER(email)')]);
|
|
||||||
|
|
||||||
Log::info("Email lowercase conversion completed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// 无法恢复原始大小写
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user