-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Adds parser support for commas in ER diagram attribute types #5128
base: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #5128 +/- ##
=======================================
Coverage 5.74% 5.74%
=======================================
Files 276 276
Lines 41905 41905
Branches 514 514
=======================================
Hits 2407 2407
Misses 39498 39498
Flags with carried forward coverage won't be shown. Click here to find out more. |
Really great and important feature. It's only one character diff. Would be great if review won't take ages 🙏 |
@nirname @sidharthv96 anything I can do to help get this merged? |
+1 this functionality is needed to generate accurate ERD data types. |
Hello! Thanks for the contribution. There are another PR with slightly different approach, which presumably covers the same subject The latter one is slightly newer than this, and some documentation are still missing, but it would be great to solve the issue one way or another. I think that escapement is more diverse and extensible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is OK, but I would prefer another PR which covers this subject also, but not limited to
📑 Summary
This short patch adds support for commas in the attribute types of ER diagrams. This helps to support commonly used SQL types such as
NUMERIC(precision,scale)
(orDECIMAL
) orGEOMETRY(geometry_type,SRID)
. While ER diagrams are not exclusive to SQL, this kind of additional support may help others to leverage Mermaid's ER diagrams for the use case of describing SQL databases, without impacting functionality for those who aren't using ER diagrams for SQL.AFAIK, this has not yet been reported as an issue.
📏 Design Decisions
The implementation is pretty straightforward:
,
to the set of accepted characters in the ER diagram grammar (maybe this needs to be even more sophisticated by looking specifically for a comma-delimited list of tokens only within parentheses? let me know what you think!)📋 Tasks
Make sure you
📓 have added documentation. Make sureI did not add any new documentation, as this might be considered a bug vs. a new feature. Let me know if you think this is relevant for this patch!MERMAID_RELEASE_VERSION
is used for all new features.develop
branch