rom-rb/rom-relation — pull request #56 by snusnu (2013-06-12 01:25:21+00:00)
Title: Introduce ROM::Schema

References: #55

Opening early for discussion. As long as we don't need a graph (because we have no relationships), let's start flat and simple. Everything is up for debate.

I could imagine adding a `ROM::Schema::Definition#reference` method which would create something like a `ROM::Reference` object. This would basically encapsulate all that's needed for an FK constraint.

Once `ROM::Schema#references` is added, we basically have all the information we need for "strongly connected nodes" (aka edges in a graph, aka `many_to_one` - and if we go bidirectional - `one_to_one` (FK is unique) or `one_to_many` (FK is not unique) relationships). "Weakly connected nodes" (aka `many_to_many` relationships) can imo be built on top of those (by walking along a chain of strongly connected nodes).

Also note that the current implementation wraps `Axiom::Relation` instances. That's the right thing to do imo. I have a few ideas how to support both schemas containing axiom and/or rom relations. I will outline them tomorrow.