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