Skip to content

Instantly share code, notes, and snippets.

@rohan-krishna
Last active December 27, 2018 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohan-krishna/f0519e1205f90e4204cdaa813c58b921 to your computer and use it in GitHub Desktop.
Save rohan-krishna/f0519e1205f90e4204cdaa813c58b921 to your computer and use it in GitHub Desktop.
1375144f4718_tasks_migration_final
<?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