Skip to content

Commit

Permalink
fix: migration 2017_01_28_222114_remove_viewed_at_from_contacts (#6963)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexis Saettler <[email protected]>
  • Loading branch information
JensGryspeert and asbiin authored Oct 31, 2023
1 parent 3a0b189 commit ff22463
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class RemoveViewedAtFromContacts extends Migration
*/
public function up()
{
Schema::table('contacts', function (Blueprint $table) {
$table->dropColumn(
'viewed_at'
);
});
if (Schema::hasColumn('contacts', 'viewed_at')) {
Schema::table('contacts', function (Blueprint $table) {
$table->dropColumn('viewed_at');
});
}
}

/**
Expand All @@ -27,8 +27,10 @@ public function up()
*/
public function down()
{
Schema::table('contacts', function (Blueprint $table) {
$table->dateTime('viewed_at')->nullable();
});
if (! Schema::hasColumn('contacts', 'viewed_at')) {
Schema::table('contacts', function (Blueprint $table) {
$table->dateTime('viewed_at')->nullable();
});
}
}
}

0 comments on commit ff22463

Please sign in to comment.