Skip to content
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

Error processing foreign key constraints #2

Open
cdiaz opened this issue Nov 2, 2024 · 0 comments
Open

Error processing foreign key constraints #2

cdiaz opened this issue Nov 2, 2024 · 0 comments

Comments

@cdiaz
Copy link

cdiaz commented Nov 2, 2024

It appears that there’s an issue in metadata.js when processing foreign key constraints. Specifically, the error TypeError: Cannot read properties of null (reading '1') suggests that a null value is being accessed within the constraint.sql.match function on line 88.

duckerd -d /path/mydb -o /path/erd.png -f png -t neutral -w 1600

Generating ERD diagram...
/Users/xxx/.nvm/versions/node/v22.11.0/lib/node_modules/duckerd/dist/lib/metadata.js:88

    }\n${table.constraints?.filter((constraint) => constraint.constraintType === "FOREIGN KEY").map((constraint) => `    "${table.databaseName}.${constraint.sql.match(/(?:^|)REFERENCES\s([^*]+?)\b\(/i)[1]}" ||--o{ "${table.databaseName}.${table.name}" : has`).join("\n")}`;

TypeError: Cannot read properties of null (reading '1')

    at /Users/xxx/.nvm/versions/node/v22.11.0/lib/node_modules/duckerd/dist/lib/metadata.js:88:202
    at Array.map (<anonymous>)
    at /Users/xxx/.nvm/versions/node/v22.11.0/lib/node_modules/duckerd/dist/lib/metadata.js:88:97
    at Array.map (<anonymous>)
    at generateMermaidCodeForAllDBs (/Users/xxx/.nvm/versions/node/v22.11.0/lib/node_modules/duckerd/dist/lib/metadata.js:85:35)
    at createERD (/Users/xxx/.nvm/versions/node/v22.11.0/lib/node_modules/duckerd/dist/commands/erd.js:11:69)
    at async run (/Users/xxx/.nvm/versions/node/v22.11.0/lib/node_modules/duckerd/dist/index.js:53:28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant