Skip to main content
← Back to index page

🔑 Support Composite Foreign Key

dbdiagram now support composite foreign key!

Syntax

//Long form
Ref name_optional {
table1.(column1, column2,...) [<|>|-] table2.(columnA, columnB,...)
}

//Short form:
Ref name_optional: table1.(column1, column2,...) [<|>|-] table2.(columnA, columnB,...)

Example

Table user {
id int
country_code int
}
Table account {
user_id int
country_code int
}
Ref: user.(id, country_code) - account.(user_id, country_code)