Composite foreign key constraint not shows in table detalisation
Database management in a single PHP file
Brought to you by:
jakubvrana
Dump shows "child_ibfk_1" composite key. In attachement - adminer screenshot/
Version: 10.1.35-MariaDB-1~wheezy
-- Adminer 4.7.1 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS child;
CREATE TABLE child (
fk_field_1 tinyint(2) NOT NULL,
fk_field_2 varchar(20) NOT NULL,
field_3 varchar(100) NOT NULL,
KEY fk_field_1_fk_field_2 (fk_field_1,fk_field_2),
** CONSTRAINT child_ibfk_1 FOREIGN KEY (fk_field_1, fk_field_2) REFERENCES parent (pk_field_1, pk_field_2)**
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2019-04-16 11:37:39
Sorry, wrong screenshot. This actual
Same here. A simple table with a FK on 2 columns or more isn't shown in the list. We just can see the index (and we can't delete it of course);
show create table 'my_table'shows the FKs correctly.Quite boring because to modify the FK, you have to drop / recreate manually
Thank you for your investigations
Jacques
I have the same problem. Thanks!
Br, Thomas
Fixed by 36ade4e1.
The change in that commit to rely on information schema has made adminer unusable. The performance of querying the KEY_COLUMN_USAGE table in many cases is just brutal (i.e. mins not ms).
I realize this comment is not particularly helpful. It's more so just to have this out there.
This is actually very useful, thanks for the feedback. Can you please benchmark these queries?
Can you please also replace
*in the case 1 and 2 byCONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, REFERENCED_TABLE_NAME, DELETE_RULE, UPDATE_RULEto see if it makes any difference?If all of these queries perform poorly then I'll have go back to parsing the
SHOW CREATE TABLEbecause performance is a development priority for Adminer.Here's the low-down.
Last edit: funkjedi 2019-07-23
I've reverted to the original faster code and fixed a trivial bug that was in that.