first commit
This commit is contained in:
27
vendor/yiisoft/yii2/views/_addForeignKeys.php
vendored
Normal file
27
vendor/yiisoft/yii2/views/_addForeignKeys.php
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var array $foreignKeys
|
||||
* @var string $table
|
||||
*/
|
||||
|
||||
?>
|
||||
<?php foreach ($foreignKeys as $column => $fkData): ?>
|
||||
|
||||
// creates index for column `<?= $column ?>`
|
||||
$this->createIndex(
|
||||
'<?= $fkData['idx'] ?>',
|
||||
'<?= $table ?>',
|
||||
'<?= $column ?>'
|
||||
);
|
||||
|
||||
// add foreign key for table `<?= $fkData['relatedTable'] ?>`
|
||||
$this->addForeignKey(
|
||||
'<?= $fkData['fk'] ?>',
|
||||
'<?= $table ?>',
|
||||
'<?= $column ?>',
|
||||
'<?= $fkData['relatedTable'] ?>',
|
||||
'<?= $fkData['relatedColumn'] ?>',
|
||||
'CASCADE'
|
||||
);
|
||||
<?php endforeach;
|
||||
Reference in New Issue
Block a user