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 27, 2023
1 parent b01112b commit e138b0f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand All @@ -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();
});
}
Expand Down

0 comments on commit e138b0f

Please sign in to comment.