<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQAAnswerOptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qa_answer_options', function (Blueprint $table) {
            $table->id();
            $table->text('display_text');
            $table->string('value');
            $table->unsignedBigInteger('order')->default(0);
            $table->unsignedBigInteger('question_number');
            $table->unsignedBigInteger('next_question_number')->nullable();
            $table->unsignedBigInteger('questionnaire_set_id');
            $table->timestamps();
            $table->softDeletes();

            $table->foreign('questionnaire_set_id')->references('id')->on('qa_questionnaire_sets');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qa_answer_options');
    }
}
