| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class CreateQuizQuestionsTable extends Migration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Run the migrations. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | if (Schema::hasTable('quiz_questions')) return; |
||
| 17 | |||
| 18 | Schema::create('quiz_questions', function (Blueprint $table) { |
||
| 19 | $table->increments('id'); |
||
| 20 | $table->integer('quiz_id')->unsigned()->index(); |
||
| 21 | $table->text('question'); |
||
| 22 | $table->timestamps(); |
||
| 23 | |||
| 24 | $table->foreign('quiz_id') |
||
| 25 | ->references('id') |
||
| 26 | ->on('quizzes') |
||
| 27 | ->onDelete('cascade') |
||
| 28 | ->onUpdate('cascade'); |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Reverse the migrations. |
||
| 34 | * |
||
| 35 | * @return void |
||
| 36 | */ |
||
| 37 | public function down() |
||
| 40 | } |
||
| 41 | } |
||
| 42 |