修复:reserved_until 列允许 NULL(permanent 禁用词无到期时间)
- 迁移文件补充 ->nullable()->change() 使 reserved_until 兼容 permanent 类型 - Tinker 直接执行 ALTER TABLE 修复已运行的迁移(无需回滚)
This commit is contained in:
@@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 执行迁移:新增 type 和 reason 列。
|
* 执行迁移:新增 type 和 reason 列,同时将 reserved_until 改为可空。
|
||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
@@ -25,6 +25,9 @@ return new class extends Migration
|
|||||||
->after('username')
|
->after('username')
|
||||||
->comment('temp=改名临时保留 | permanent=管理员永久禁用词');
|
->comment('temp=改名临时保留 | permanent=管理员永久禁用词');
|
||||||
|
|
||||||
|
// permanent 记录无到期时间,需要允许 NULL
|
||||||
|
$table->timestamp('reserved_until')->nullable()->change();
|
||||||
|
|
||||||
// 禁用原因(permanent 时填写)
|
// 禁用原因(permanent 时填写)
|
||||||
$table->string('reason', 100)
|
$table->string('reason', 100)
|
||||||
->nullable()
|
->nullable()
|
||||||
|
|||||||
Reference in New Issue
Block a user