Skip to content

Commit

Permalink
Enhance Robustness of RemoveViewedAtFromContacts Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
JensGryspeert committed Oct 28, 2023
1 parent b01112b commit 15aa483
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class RemoveViewedAtFromContacts extends Migration
public function up()
{
Schema::table('contacts', function (Blueprint $table) {
$table->dropColumn(
'viewed_at'
);
if ($table->hasColumn('viewed_at')) {
$table->dropColumn('viewed_at');
}
});
}

Expand All @@ -28,7 +28,9 @@ public function up()
public function down()
{
Schema::table('contacts', function (Blueprint $table) {
$table->dateTime('viewed_at')->nullable();
if ($table->hasColumn('viewed_at')) {
$table->dateTime('viewed_at')->nullable();
}
});
}
}

0 comments on commit 15aa483

Please sign in to comment.