-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Description
- many to 1 is a non-nullable foreign key.
- many to [0..1] is a nullable foreign key.
- [0..1] to 1 is a unique non-nullable foreign key.
- [0..1] to [0..1] is a unique nullable foreign key.
The cardinality of ref: > relationships should be inferred from the unique, null, and not null constraints.
Table posts {
// A user may create many posts. A post has only one creator.
created_by integer [ref: > users.id, not null] // many to 1
// A user may update many posts. A post might not be updated.
last_updated_by integer [ref: > users.id, null] // many to [0..1]
}
Table compliance_training_completions {
// An employee might not have completed the compliance training.
// A completion record is specific to one employee.
created_by integer [ref: > employees.id, unique, not null] // [0..1] to 1
}
Table departments {
// A department may or may not have a manager.
// An employee can manage at most one department.
manager_id integer [ref: > employees.id, unique, null] // [0..1] to [0..1]
}
Correct me if I'm wrong. Currently, there's no way to specify the [0..1] to 1 and [0..1] to [0..1] relationships in DBML.
Metadata
Metadata
Assignees
Labels
No labels