Skip to content

Commit

Permalink
Update 2021_11_08_091231_create_tasks_table.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hmdee authored Nov 7, 2024
1 parent bfe388a commit 89c5f8e
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions database/migrations/task1/2021_11_08_091231_create_tasks_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ class CreateTasksTable extends Migration
*
* @return void
*/
public function up()
public function up()
{
Schema::create('tasks', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->string('name');
$table->timestamps();
});
if (!Schema::hasTable('tasks')) {
Schema::create('tasks', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->string('name');
$table->timestamps();
});}
else {
Schema::create('tasks', function (Blueprint $table) {
$table->foreignId('user_id');
});
}
}


/**
* Reverse the migrations.
*
Expand Down

0 comments on commit 89c5f8e

Please sign in to comment.