One-to-Many Relations

A one-to-many relation means that one record in a type is associated with one or more record in another type.

 type Customer struct {id int unique, relation addr Address optional many  } end
 type Address struct {id int unique, relation cust Customer one } end

Here a customer has zero or more addresses, and an address has one customer.

With one-to-many, the many side is always the parent, and the foreign key is put in the child side. In our example, Customer is the parent side, and Address is the child side.

One-to-many relations must have at least one side be optional.