Skip to content

Commit

Permalink
Update 2021_11_09_083121_update_users_table.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Seddek-Nadhem committed Sep 13, 2024
1 parent 950d521 commit 02cf699
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ class UpdateUsersTable extends Migration
public function up()
{
// TASK: add an if-statement in this file to NOT add column if it already exists
Schema::table('users', function (Blueprint $table) {
$table->string('name');
});
if (!Schema::hasColumn('users', 'name')) {
Schema::table('users', function (Blueprint $table) {
$table->string('name');
});
}

}

/**
* Reverse the migrations.
*
Expand Down

0 comments on commit 02cf699

Please sign in to comment.