Laravel.io
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTaskListsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('task_lists', function (Blueprint $table) {
$table->bigIncrements('id');
//Chave Estrangeira (Tabela recurrences)
$table->bigInteger('recurrence_id')->unsigned();
$table->foreign('recurrence_id')->references('id')->on('recurrences');
//Chave Estrangeira (Tabela users)
$table->bigInteger('concluding_user_id')->unsigned()->comment('Quem concluiu a atividade');
$table->foreign('concluding_user_id')->references('id')->on('users');
//Chave Estrangeira (Tabela task_types)
$table->bigInteger('task_type_id')->unsigned();
$table->foreign('task_type_id')->references('id')->on('task_types');
//Chave Estrangeira (Tabela statuses)
$table->bigInteger('status_id')->unsigned();
$table->foreign('status_id')->references('id')->on('statuses');
$table->integer('number_of_process')->default(1);
$table->string('expire_day',2);
$table->dateTime('expire_date');
$table->dateTime('start_date')->nullable();
$table->dateTime('end_date')->nullable();
$table->text('details',2000)->nulable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('task_lists');
}
}