<?php

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

class CreateQuestionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('questions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->smallInteger('type')->default(1)->nullable()->comment('题目类型 1：学科知识 2：兴趣偏向');
            $table->unsignedBigInteger('unit_id')->default(null)->nullable()->comment('所属单元，如果为null，为pre-test的问题');
            $table->unsignedBigInteger('subject_id')->default(null)->nullable()->comment('所属学科');
            $table->unsignedBigInteger('order')->default(null)->nullable()->comment('序号');
            $table->text('name')->nullable()->comment('题目');
            $table->smallInteger('correct_answer')->default(null)->nullable()->comment('正确选项');
            $table->timestamps();
        });

        // - id
        // - type(1-subject 2 rating)
        // - correct_answer(答案)
        // - subject_id(所属学科)
        // - order
        // - A
        // - B
        // - C
        // - D
    }

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