From 725edb11a30b79cf49278147a1a8e3546d73386e Mon Sep 17 00:00:00 2001 From: baodev0 Date: Thu, 15 Oct 2026 08:31:18 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20migration=202FA=20l=E1=BB=97i=20Invalid?= =?UTF-8?q?=20default=20value=20cho=20expires=5Fat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MySQL tắt explicit_defaults_for_timestamp gán default 0000-00-00 cho TIMESTAMP NOT NULL không phải cột timestamp đầu tiên, bị NO_ZERO_DATE chặn. Đổi expires_at sang DATETIME; bỏ qua thêm two_factor_enabled nếu đã có (DDL MySQL không rollback nên lần chạy lỗi trước đã thêm cột). Co-Authored-By: Claude Opus 5.5 --- .../2026_10_13_000003_add_two_factor_to_customers.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/database/migrations/2026_10_13_000003_add_two_factor_to_customers.php b/database/migrations/2026_10_13_000003_add_two_factor_to_customers.php index cccdb11..36adc6f 100644 --- a/database/migrations/2026_10_13_000003_add_two_factor_to_customers.php +++ b/database/migrations/2026_10_13_000003_add_two_factor_to_customers.php @@ -7,9 +7,11 @@ use Illuminate\Support\Facades\Schema; return new class extends Migration { public function up(): void { - Schema::table('customers', function (Blueprint $table) { - $table->boolean('two_factor_enabled')->default(false); - }); + if (! Schema::hasColumn('customers', 'two_factor_enabled')) { + Schema::table('customers', function (Blueprint $table) { + $table->boolean('two_factor_enabled')->default(false); + }); + } Schema::create('customer_trusted_devices', function (Blueprint $table) { $table->id(); @@ -18,7 +20,7 @@ return new class extends Migration { $table->string('user_agent', 255)->nullable(); $table->string('ip_address', 45)->nullable(); $table->timestamp('last_used_at')->nullable(); - $table->timestamp('expires_at')->index(); + $table->dateTime('expires_at')->index(); $table->timestamps(); }); }