Diagram not showing relation? Foreign Key constraint is there...

Answered

Hello!

I'm currently trying out DataGrip and am facing a dead end here. I have created a very basic database in another program and DataGrip actually gets the data right, but it doesn't show the relation. I didn't find anything I had to enable to get this to work.

 

you can see the book_fk, but it doesn't show up in the diagram.

Any ideas?

10 comments
Comment actions Permalink

Hello,

It is known issue with table relations not displaying. Please vote and follow related requests in YouTrack: https://youtrack.jetbrains.com/issue/DBE-1781https://youtrack.jetbrains.com/issue/DBE-2130 .

1
Comment actions Permalink

I have also run into this issue. Is there any chance that we'll be getting a fix?

1
Comment actions Permalink

Atalipov,

I submitted a new issue DBE-13750 based on your description.

1
Comment actions Permalink

I have the same problem using SQLite. With MySQL works fine. I believe this is because SQLite does not enforce foreign keys (http://sqlite.org/foreignkeys.html)

0
Comment actions Permalink

Any fix expected soon?

0
Comment actions Permalink

Currently I have no ETA for this. Most probably not in the nearest DataGrip versions.

0
Comment actions Permalink

Any update? I see foreign keys for MySQL just fine but they're missing altogether for DB2. DbVisualizer has no issues with it.

0
Comment actions Permalink
The bug's still not fixed.So vizualization mode is not working.
0
Comment actions Permalink

Atalipov,

Could you provide a sample DDL to reproduce the issue?

0
Comment actions Permalink

Yes, sure.

I use Database Tools and SQL plugin 211.7442.57.

--
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.22
-- Dumped by pg_dump version 9.6.22

CREATE SCHEMA s2;

ALTER SCHEMA s2 OWNER TO postgres;

CREATE TABLE s2.work_block (
work_item_id bigint NOT NULL
);

ALTER TABLE s2.work_block OWNER TO postgres;

CREATE TABLE s2.work_board (
work_item_id bigint NOT NULL
);

ALTER TABLE s2.work_board OWNER TO postgres;

CREATE TABLE s2.work_item (
item_id bigint NOT NULL,
work_type smallint
);

ALTER TABLE s2.work_item OWNER TO postgres;

CREATE SEQUENCE s2.work_item_item_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE s2.work_item_item_id_seq OWNER TO postgres;

ALTER SEQUENCE s2.work_item_item_id_seq OWNED BY s2.work_item.item_id;

ALTER TABLE ONLY s2.work_block
ADD CONSTRAINT work_block_pkey PRIMARY KEY (work_item_id);

ALTER TABLE ONLY s2.work_board
ADD CONSTRAINT work_board_pkey PRIMARY KEY (work_item_id);

ALTER TABLE ONLY s2.work_item
ADD CONSTRAINT work_item_pkey PRIMARY KEY (item_id);

ALTER TABLE ONLY s2.work_item
ADD CONSTRAINT work_item__work_block FOREIGN KEY (item_id) REFERENCES s2.work_block(work_item_id);

ALTER TABLE ONLY s2.work_item
ADD CONSTRAINT work_item__work_board FOREIGN KEY (item_id) REFERENCES s2.work_board(work_item_id);
0

Please sign in to leave a comment.