DataGrip fails to draw correct diagram
Answered
DataGrip ignores some of the foregn keys of a MySQL db.
Please sign in to leave a comment.
What IDE version do you use? Could you please provide the DDL examples for the tables which do not have the keys on diagram?
What IDE version do you use? Please add the DDL for these tables.
I don't know what was the version of DataGrip but it was the latest on the site.
Here are two of the tables that misbehave:
CREATE TABLE `Building` (
`id` int(11) NOT NULL,
`description` varchar(45) NOT NULL,
`managedGridId` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `BuildingAddress` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`managedGridId` int(11) NOT NULL,
`buildingId` int(11) DEFAULT NULL,
`addressId` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_BuildingAddress_Building1_idx` (`buildingId`),
KEY `fk_BuildingAddress_Address1_idx` (`addressId`),
CONSTRAINT `fk_BuildingAddress_Address1` FOREIGN KEY (`addressId`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION,
CONSTRAINT `fk_BuildingAddress_Building1` FOREIGN KEY (`buildingId`) REFERENCES `building` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
in the `FOREIGN KEY` reference clause you have `building` referenced with the small letter, but create table statement uses capital B. When I change it to capital letter and create the script it works:
Does it help?
Thanks. I understand, but this is what I get from MySQL, which leaves me without a solution. I think MySQL behaves that way because it is installed on a Windows platform which is case insensitive.
Not sure I understand completely, could you clarify? I also tested it on Windows. How did you get the DDL, shown in previous message? Have you configured any additional jdbc properties for data source (e.g. in Advanced tab or in jdbc URL)? Please also attach Details output from Test Connection button for the Data Source. Thank you. It would be great to understand how we could reproduce the issue.
I have not touched the advanced settings, so it is all defaults.
Here are the Details from Test Connection:
Database: MySQL (ver. 5.7.20-log) Identifier case sensitivity: mixed (plain), upper (delimited) Driver (JDBC4.0): MySQL Connector Java (ver. mysql-connector-java-5.1.46 ( Revision: 9cc87a48e75c2d2e87c1a293b2862ce651cb256e ))
The DDL came from MySQL Workbench.
>The DDL came from MySQL Workbench.
Could you please provide the DDL as is shown by IDE for these tables?
Please also try if it helps to invoke Forget Cached schemas and re-synchronize the Data Source (step 4 in Resolving visualization problems). Thank you.
It produced the same results after re-synchronization.
Here is the DDL from the IDE:
Thank you for details. I've filled the https://youtrack.jetbrains.com/issue/DBE-6225 issue. Please vote and follow for updates.