Closed dkubb closed 11 years ago
This code is looking close to what I wanted when I started on it.
The remaining task is to add an assertion to the constructor to ensure the keys are irreducible. For example, given the following:
Veritas::Relation::Keys.coerce([ header.project([ :id, :name ]), header.project([ :id ]) ])
Two headers were provided, yet the second is a proper subset of the first. This should cause an exception to be raised. Every key must not be a proper subset of another key.
fwiw, I decided to add the key irreducibility check in another branch. This one was functional, so I wanted to get it merged into master sooner rather than later.
This branch adds key support to relations. It introduces a new object called Relation::Keys, which is basically a set of Relation::Header objects, each of them representing a candidate key. A Relation::Header#keys attribute stores a reference to the keys for the relation.