From 11821b0fae3cf41a2c99a409934bf7b113bf0593 Mon Sep 17 00:00:00 2001 From: BT Date: Sat, 2 May 2026 22:02:25 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20**Migration:**=20Added?= =?UTF-8?q?=20safety=20checks=20in=20`add=5Freputation=5Ffield=5Fon=5Fuser?= =?UTF-8?q?=5Ftable`=20migration=20to=20prevent=20redundant=20schema=20alt?= =?UTF-8?q?erations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...23_01_14_185804_add_reputation_field_on_user_table.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/migrations/2023_01_14_185804_add_reputation_field_on_user_table.php b/database/migrations/2023_01_14_185804_add_reputation_field_on_user_table.php index ce6c78c..63f25c5 100644 --- a/database/migrations/2023_01_14_185804_add_reputation_field_on_user_table.php +++ b/database/migrations/2023_01_14_185804_add_reputation_field_on_user_table.php @@ -11,6 +11,10 @@ return new class extends Migration */ public function up(): void { + if (Schema::hasColumn('users', 'reputation')) { + return; + } + Schema::table('users', function (Blueprint $table) { $table->unsignedInteger('reputation')->default(0)->after('remember_token'); }); @@ -21,6 +25,10 @@ return new class extends Migration */ public function down(): void { + if (! Schema::hasColumn('users', 'reputation')) { + return; + } + Schema::table('users', function (Blueprint $table) { $table->dropColumn('reputation'); });