dbml icon indicating copy to clipboard operation
dbml copied to clipboard

Make duplicated reference error more clear

Open tntrex opened this issue 3 years ago • 1 comments

I got an error when trying to convert mysql dump with sql2dbml

ERROR: You have a syntax error at "dump.sql" line 1 column 1. Reference with same endpoints duplicated

This error doesn't really help to figure it out what's wrong with my dump. I found that this error triggered here.

I think this error message can be more clear if you can add reference details like name, endpoints, real position in source file.

Some people on the forums have also encountered this error: https://community.dbdiagram.io/t/importing-from-mysql-file/762/3

tntrex avatar Jan 26 '22 16:01 tntrex

I was able to fix this by selectively deleting portions of the file until the error went away. It looks like it had issue with the final alter table statement. Here is the obfuscated statement.

ALTER TABLE ONLY public.ducks ADD CONSTRAINT ducks_pond_id_fkey_fkey FOREIGN KEY (pond_id_fkey) REFERENCES public.ponds(id);

Eunoia avatar Jun 08 '22 18:06 Eunoia