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 { // 无法恢复原始大小写 } };