-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SchemaSpy automatically detects only Foreign Keys that reference a Primary Key #1342
Comments
Sorry for the delayed response. We do check constraints information in the database and in that case it needs to be defined. We have the implied, which I need to double check if it has that type of limitation. I can image it does since the scope might get to broad. There is an open issue that it behaves strangely with multiple children/parents. I think we sadly have an old PR for adding support for composite keys. Lastly we have the rails convention thing, there has been a feature request for supporting this thru patterns but we haven't gotten to it. If you could provide a simple sample I could further advice you and also check. If you only want it added to the documentation it could be added thru SchemaMeta. |
Hi,
The FOREIGN KEY named channel_fk1 is not automatically detected by SchemaSpy and it appears in the generated documentation only if I add it in schemaspy.xml, as following:
Thanks |
@riccardopedron96 What database is this for? |
Oracle |
@riccardopedron96 I am getting "ORA-02270: no matching unique or primary key for this column-list" for your sample code, since there is no unique constraint on |
@riccardopedron96 I suggest the following example to highlight your issue: CREATE TABLE communication
(
id NUMBER(11) NOT NULL,
communication_code VARCHAR2(3) NOT NULL,
description VARCHAR2(100) NOT NULL
);
ALTER TABLE communication
ADD CONSTRAINT communication_uq
UNIQUE (communication_code);
CREATE TABLE channel
(
id NUMBER(11) NOT NULL,
channel_code VARCHAR2(2) NOT NULL,
description VARCHAR2(20),
communication_code_fk VARCHAR2(3) NOT NULL
);
ALTER TABLE channel
ADD CONSTRAINT channel_fk1
FOREIGN KEY (communication_code_fk)
REFERENCES communication (communication_code);
|
@sualeh thanks for fixing the example. The problem is that the FK dosen't reference a PK which seems to be a requirement for JDBC API DatabaseMetaData#getImportedKeys I've had a look at the code and also found the However the JDBC specification says
So if that was fixed it would be possible for SchemaSpy to use But I think I'll keep this as an enhancement. SchemaSpy is missing the FK to index-column-that-isnt-PK feature. The enhancement would be:
|
Hi,
Using SchemaSpy 6.2.4 I've noticed that only Foreign Keys that reference a Primary Key were automatically detected.
It's the intended behaviour?
If so, it's possible to add a command line flag to change that behaviour so that all FKs are automatically detected and made visibile in the relationship graphs?
Or maybe there is already a workaround for this?
Let me know if you need more details
Thanks
Riccardo
The text was updated successfully, but these errors were encountered: