Last active
December 27, 2018 12:32
-
-
Save rohan-krishna/f0519e1205f90e4204cdaa813c58b921 to your computer and use it in GitHub Desktop.
1375144f4718_tasks_migration_final
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateTasksTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('tasks', function (Blueprint $table) { | |
$table->increments('id'); | |
$table->string('name')->default('Untitled Task'); // Task Name | |
$table->boolean('is_completed')->default(false); // Task Completed Status ( default to be false ) | |
$table->integer('owner_id')->unsigned()->index(); // Task Owner ( We'll use Laravel's User Model ) | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('tasks'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment