Allow Foreign keys to be added on non-indexed columns, if it's an InnoDB table
InnoDB automatically creates an index over the column, which can be replaced by defining a new index over the same column. Fix #12665 Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
This commit is contained in:
parent
2fbf09ba2d
commit
1475c0e811
@ -8,11 +8,20 @@
|
||||
<tr>
|
||||
<th><?= __('Actions'); ?></th>
|
||||
<th><?= __('Constraint properties'); ?></th>
|
||||
<th><?= __('Column') , PMA\libraries\Util::showHint(__(
|
||||
'Only columns with index will be displayed. You can define an'
|
||||
. ' index below.'
|
||||
)) ?>
|
||||
</th>
|
||||
<?php if (strtoupper($tbl_storage_engine) == 'INNODB'): ?>
|
||||
<th><?= __('Column') , PMA\libraries\Util::showHint(__(
|
||||
'Creating a foreign key over a non-indexed column would automatically create'
|
||||
. ' an index on it. Alternatively, you can define an index below, before creating'
|
||||
. ' the foreign key.'
|
||||
)) ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th><?= __('Column') , PMA\libraries\Util::showHint(__(
|
||||
'Only columns with index will be displayed. You can define an'
|
||||
. ' index below.'
|
||||
)) ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th colspan="3">
|
||||
<?= __('Foreign key constraint'); ?> (<?= $tbl_storage_engine; ?>)
|
||||
</th>
|
||||
|
||||
@ -35,7 +35,9 @@ $on_update = isset($one_key['on_update'])
|
||||
$column_array = array();
|
||||
$column_array[''] = '';
|
||||
foreach ($columns as $column) {
|
||||
if (! empty($column['Key'])) {
|
||||
if (strtoupper($tbl_storage_engine) == 'INNODB'
|
||||
|| ! empty($column['Key'])
|
||||
) {
|
||||
$column_array[$column['Field']] = $column['Field'];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user