You've already forked Atomcms-edit
Add migration to fix NULL last_username_change values and enforce default 0
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('users')
|
||||
->whereNull('last_username_change')
|
||||
->orWhere('last_username_change', 0)
|
||||
->update(['last_username_change' => 0]);
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->integer('last_username_change')->default(0)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Cannot reliably revert default and data changes
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user