for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateQuestionChoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
if (Schema::hasTable('question_choices')) return;
Schema::create('question_choices', function (Blueprint $table) {
$table->increments('id');
$table->integer('question_id')->unsigned()->index();
$table->enum('is_right_choice', [0, 1])->nullable();
$table->text('choice');
$table->timestamps();
$table->foreign('question_id')
->references('id')
->on('quiz_questions')
->onDelete('cascade')
->onUpdate('cascade');
});
}
* Reverse the migrations.
public function down()
Schema::dropIfExists('question_choices');