Merge pull request #2237 from RonaldZielaznicki/2070_more_columns_for_entity_relationship_diagrams

2070: Update ER Diagram to have keys and comments.
This commit is contained in:
Knut Sveidqvist
2021-09-09 17:50:38 +02:00
committed by GitHub
5 changed files with 190 additions and 26 deletions

View File

@@ -191,6 +191,28 @@ erDiagram
The `type` and `name` values must begin with an alphabetic character and may contain digits, hyphens or underscores. Other than that, there are no restrictions, and there is no implicit set of valid data types.
#### Attribute Keys and Comments
Attributes may also have a `key` or comment defined. Keys can be "PK" or "FK", for Primary Key or Foreign Key. And a `comment` is defined by quotes at the end of an attribute. Comments themselves cannot have quote characters in them.
```mermaid
erDiagram
CAR ||--o{ NAMED-DRIVER : allows
CAR {
string allowedDriver FK 'The license of the allowed driver'
string registrationNumber
string make
string model
}
PERSON ||--o{ NAMED-DRIVER : is
PERSON {
string driversLicense PK 'The license #'
string firstName
string lastName
int age
}
```
### Other Things
- If you want the relationship label to be more than one word, you must use double quotes around the phrase