From e138b0f65106a87bbfb7bb01de6e538e92de1c89 Mon Sep 17 00:00:00 2001 From: jgryspeert Date: Sat, 28 Oct 2023 01:03:16 +0200 Subject: [PATCH] Enhance Robustness of RemoveViewedAtFromContacts Migration --- .../2017_01_28_222114_remove_viewed_at_from_contacts.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/migrations/2017_01_28_222114_remove_viewed_at_from_contacts.php b/database/migrations/2017_01_28_222114_remove_viewed_at_from_contacts.php index c572a5a67e8..85bd98bdba4 100644 --- a/database/migrations/2017_01_28_222114_remove_viewed_at_from_contacts.php +++ b/database/migrations/2017_01_28_222114_remove_viewed_at_from_contacts.php @@ -14,6 +14,10 @@ class RemoveViewedAtFromContacts extends Migration public function up() { Schema::table('contacts', function (Blueprint $table) { + if (!$table->hasColumn('viewed_at')) { + return; + } + $table->dropColumn( 'viewed_at' ); @@ -28,6 +32,10 @@ public function up() public function down() { Schema::table('contacts', function (Blueprint $table) { + if ($table->hasColumn('viewed_at')) { + return; + } + $table->dateTime('viewed_at')->nullable(); }); }