database/migrations/2016_05_12_151904_create_exercises_table.php
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateExercisesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exercises', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('description',1500)->nullable();
$table->integer('topic_id')->unsigned();
$table->foreign('topic_id')->references('id')->on('topics');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('exercises');
}
}