| Conditions | 3 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 26 | public function up(Schema $schema): void |
||
| 27 | { |
||
| 28 | $table = $schema->getTable('c_quiz_question_rel_category'); |
||
| 29 | $cQuizQuestionTable = $schema->getTable('c_quiz_question'); |
||
| 30 | $cQuizQuestionCategoryTable = $schema->getTable('c_quiz_question_category'); |
||
| 31 | |||
| 32 | $fks = $table->getForeignKeys(); |
||
| 33 | |||
| 34 | if (!empty($fks)) { |
||
| 35 | foreach ($fks as $fk) { |
||
| 36 | $table->removeForeignKey($fk->getName()); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | $table->addForeignKeyConstraint( |
||
| 41 | $cQuizQuestionTable, |
||
| 42 | ['question_id'], |
||
| 43 | ['iid'], |
||
| 44 | ['onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'], |
||
| 45 | ); |
||
| 46 | $table->addForeignKeyConstraint( |
||
| 47 | $cQuizQuestionCategoryTable, |
||
| 48 | ['category_id'], |
||
| 49 | ['iid'], |
||
| 50 | ['onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'], |
||
| 51 | ); |
||
| 54 |