mermaid
mermaid copied to clipboard
Allow `erDiagram` entity names to be quoted strings.
In some systems, entities can be nested in modules and namespaces. This is commonly written with two ::
characters, but there are other ways including slashes, etc.
It would be nice to support this by allowing quoted strings as entity names.
e.g.
erDiagram
"Service::User" {
string name
string password
}
"Service::Log" {
string message
}
"Service::User" }o--o{ "Service::Log" : has_many
There is the same issue in class diagrams, I would like to use brackets in the name
classDiagram
"ShapeData<T>" <|-- classA
EDIT: i just realized there's a bracket escape for generics using ~
I wish too to use the special charactor in erDiagram
. Bracket is needed to show mysql column type.
erDiagram
CAR {
int8 allowedDriver FK "The license of the allowed driver"
}
This is worked.
erDiagram
CAR {
int(8) allowedDriver FK "The license of the allowed driver"
"int(8)" allowedDriver FK "The license of the allowed driver"
}
Both line do not work with below error:
- Expecting 'ATTRIBUTE_WORD', got '('
- Expecting 'BLOCK_STOP', 'ATTRIBUTE_WORD', got 'COMMENT'
In Datomic-like databases (DataScript, XTDB, Datalevin...), the equivalent of table, column and column-type names are namespaced keywords, like :google.user/email
, :db.type/uuid
.
Furthermore, "column" definitions can have arbitrary attributes, but even the builtin attributes are numerous, so expecting only 4 columns is similarly unnecessarily limiting.
These drakonian limitation on the entity attribute syntax is overly limiting and would be wonderful, if it could be lifted!
Allowing quoting for all the fields would alleviate most of these problems and - I presume - wouldn't make the language syntax overly ambiguous.