| Conditions | 2 |
| Paths | 2 |
| Total Lines | 30 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | if (Schema::hasTable('user_question_answer')) return; |
||
| 17 | |||
| 18 | Schema::create('user_question_answer', function (Blueprint $table) { |
||
| 19 | $table->increments('id'); |
||
| 20 | $table->integer('user_id')->unsigned()->index(); |
||
| 21 | $table->integer('question_id')->unsigned()->index(); |
||
| 22 | $table->integer('question_choice_id')->unsigned()->index(); |
||
| 23 | $table->enum('is_right', [0, 1]); |
||
| 24 | $table->dateTime('answer_time'); |
||
| 25 | $table->timestamps(); |
||
| 26 | |||
| 27 | $table->foreign('user_id') |
||
| 28 | ->references('id') |
||
| 29 | ->on('users') |
||
| 30 | ->onDelete('cascade') |
||
| 31 | ->onUpdate('cascade'); |
||
| 32 | |||
| 33 | $table->foreign('question_id') |
||
| 34 | ->references('id') |
||
| 35 | ->on('quiz_questions') |
||
| 36 | ->onDelete('cascade') |
||
| 37 | ->onUpdate('cascade'); |
||
| 38 | |||
| 39 | $table->foreign('question_choice_id') |
||
| 40 | ->references('id') |
||
| 41 | ->on('question_choices') |
||
| 42 | ->onDelete('cascade') |
||
| 43 | ->onUpdate('cascade'); |
||
| 44 | }); |
||
| 57 |