db-schema-visualizer
db-schema-visualizer copied to clipboard
A GIST type of index in a *.dbml prevents a diagram generation
Describe the bug
A *.dbml file containing a gist index prevents a diagram generation.
Re: https://dbml.dbdiagram.io/docs#index-settings
To Reproduce Steps to reproduce the behavior:
-
Install latest
@dbml/cli(v.3.9.5)npm install -g @dbml/cli -
Generate
*.dbmlfrom DB where GIST type of index is useddb2dbml postgres 'postgresql://openstreetmap:pass@localhost:5432/openstreetmap' -o osmdb.dbml -
Inspect your
*.dbmlfiles to identify any instances of thegistkeyword. Additionally, attempt to visualize the Entity-Relationship Diagram (ERD) based on this information.Table "acls" { "id" int8 [pk, not null, increment] "address" inet "k" varchar [not null] "v" varchar "domain" varchar "mx" varchar Indexes { k [type: btree, name: "acls_k_idx"] address [type: gist, name: "index_acls_on_address"] domain [type: btree, name: "index_acls_on_domain"] mx [type: btree, name: "index_acls_on_mx"] } } -
See error
SyntaxError: Expected btree, comment, hash, or whitespace but "g" found.
If you replace
gist->hash(for example) VSCode plugin displays diagram as expected.
Expected behavior
I hope that with using up-to-date version of @dbml/core(https://www.npmjs.com/package/@dbml/core) the issue would be eliminated.
https://github.com/BOCOVO/db-schema-visualizer/blob/297ac2f4d2b959a924d0fc3ca79c3c2c67e088bf/packages/dbml-to-json-table-schema/package.json#L11
https://github.com/BOCOVO/db-schema-visualizer/blob/297ac2f4d2b959a924d0fc3ca79c3c2c67e088bf/packages/shared/package.json#L7
Additionally, it is possible to convert *.sql files according to the following link: https://dbml.dbdiagram.io/cli#convert—a-sql-file-to-dbml
The OSM DB *.sql file can be found here: https://github.com/openstreetmap/openstreetmap-website/raw/refs/heads/master/db/structure.sql
Hello @Andygol !
Thank you for giving those detail on the issue. I appreciate it. I'll try the suggestion and if it works I will ship a release.
Additionally, it is possible to convert
*.sqlfiles according to the following link: https://dbml.dbdiagram.io/cli#convert—a-sql-file-to-dbmlThe OSM DB
*.sqlfile can be found here: https://github.com/openstreetmap/openstreetmap-website/raw/refs/heads/master/db/structure.sql
But I don't really understand this point.
The OSM DB
*.sqlfile can be found here: https://github.com/openstreetmap/openstreetmap-website/raw/refs/heads/master/db/structure.sql
☝ you may use this structure.sql to test how GIST type is processed
Oh ! I understand now. You are suggesting me to convert that SQL to DBML and that it may help me in my investigation.