holistics / holistics/dbml

Cannot read property 'indexes' of undefined

Open
#118 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.7k
Forks
233
Avg merge
1d 23h
Merged PRs (30d)
4

Description

I have used the postgres **structure.sql** file generated using rake command. I ended up removing lot of stuffs from file to make below command run to get my dbml. Ended up removing all default values which had '::' in it. Then all ALTER SEQUENCE statements, data type double precision, varying[], etc.

`sql2dbml db/structure.sql --postgres -o out.dbml`

But for sure we would like to see indexes also getting documented on dbdocs.io, but unfortunately it throws error from the line index definition starts.

ex:CREATE UNIQUE INDEX admin_user_sitting_assignments_auid_sid ON public.admin_user_sitting_assignments USING btree (admin_user_id, sitting_id);

`SyntaxError: You have a syntax error at "structure.sql".
at /usr/local/lib/node_modules/@dbml/cli/lib/cli/utils.js:55:13
at Array.forEach ()
at generate (/usr/local/lib/node_modules/@dbml/cli/lib/cli/utils.js:48:14)
at importHandler (/usr/local/lib/node_modules/@dbml/cli/lib/cli/import.js:40:27)
at Object.sql2dbml (/usr/local/lib/node_modules/@dbml/cli/lib/cli/index.js:38:23)
at Object. (/usr/local/lib/node_modules/@dbml/cli/bin/sql2dbml.js:4:19)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)

ROOT_ERROR:
TypeError: Cannot read property 'indexes' of undefined
at /usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/parse/postgresParser.js:8:94
at Array.forEach ()
at peg$c0 (/usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/parse/postgresParser.js:5:4391)
at peg$parseparser (/usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/parse/postgresParser.js:33:6989)
at Object.peg$parse [as parse] (/usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/parse/postgresParser.js:41:143)
at Function.parsePostgresToJSON (/usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/parse/Parser.js:51:41)
at Function.parse (/usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/parse/Parser.js:79:32)
at Object._import [as import] (/usr/local/lib/node_modules/@dbml/cli/node_modules/@dbml/core/lib/import/index.js:15:37)
at /usr/local/lib/node_modules/@dbml/cli/lib/cli/import.js:40:68
at /usr/local/lib/node_modules/@dbml/cli/lib/cli/utils.js:52:23`

Any leads here?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.