Files
chatroom/database/migrations/2026_02_26_151000_lowercase_usersf_extension.php
lkddi bfd90ca882 统一:所有图片后缀从 .GIF 改为 .gif
- headface 目录 371 个文件重命名为小写后缀
- 代码中所有 .GIF 引用改为 .gif(User.php/AuthController/channels.php/frame.blade/scripts.blade)
- 新增迁移:将 users 表 usersf 列中的 .GIF 批量替换为 .gif
- 解决 Linux 大小写敏感导致图片加载失败的问题
2026-02-26 23:27:35 +08:00

34 lines
866 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 文件功能:将 users 表中 usersf头像文件名的大写后缀 .GIF 全部转为小写 .gif
*
* 统一文件名大小写,避免 Linux 服务器上因大小写敏感导致图片加载失败。
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 将 usersf 列中的 .GIF 后缀转为 .gif
*/
public function up(): void
{
DB::table('users')
->where('usersf', 'LIKE', '%.GIF')
->update(['usersf' => DB::raw("REPLACE(usersf, '.GIF', '.gif')")]);
}
/**
* 回滚:将 .gif 转回 .GIF
*/
public function down(): void
{
DB::table('users')
->where('usersf', 'LIKE', '%.gif')
->update(['usersf' => DB::raw("REPLACE(usersf, '.gif', '.GIF')")]);
}
};