Cannot make one-to-one relationship. Underscore isn't recognized

Hi, I have tried to make one-to-one relationships in models but there’s a bug apparently.
I write [ref: _ table.id] but it displays the following exception
Expected " " or >,_ or < but “_” found.

Hi @jorguerra, i’m Khoa from the dbdiagram team, thank you for your feedback on the dbdiagram.
We support one-to-one relationship with the following syntax:

2 Likes

Hi - still showing 1-to-many i.e.

// Creating tables
Table users as U {
id int
full_name varchar
created_at timestamp
country_code int
}

Table merchants {
id int
merchant_name varchar
country_code int
“created_at” varchar
admin_id int [ref: - U.id] // one-to-one relationship
}

With your example, the relationship will be recognized as 1-to-0. To make 1-to-1 relationship, you will need to make the admin_id not null like this: admin_id int [ref: - U.id, not null]

1 Like