_addForeignKeys.php 584 B

1234567891011121314151617181920
  1. <?php foreach ($foreignKeys as $column => $fkData): ?>
  2. // creates index for column `<?= $column ?>`
  3. $this->createIndex(
  4. '<?= $fkData['idx'] ?>',
  5. '<?= $table ?>',
  6. '<?= $column ?>'
  7. );
  8. // add foreign key for table `<?= $fkData['relatedTable'] ?>`
  9. $this->addForeignKey(
  10. '<?= $fkData['fk'] ?>',
  11. '<?= $table ?>',
  12. '<?= $column ?>',
  13. '<?= $fkData['relatedTable'] ?>',
  14. '<?= $fkData['relatedColumn'] ?>',
  15. 'CASCADE'
  16. );
  17. <?php endforeach;