View on GitHub
Schemas hold detailed information about relation tuples, including their
primitive types (String, Integer, Hash, etc. or custom classes), as well as
various meta information like primary/foreign key and literally any other
information that a given database adapter may need.
Adapters can extend this class and it can be used in adapter-specific relations.
In example rom-sql extends schema with Association DSL and many additional
SQL-specific APIs in schema types.
Schemas are used for projecting canonical relations into other relations and
every relation object maintains its schema. This means that we always have
all information about relation tuples, even when a relation was projected and
diverged from its canonical form.
Furthermore schema attributes know their source relations, which makes it
possible to merge schemas from multiple relations and maintain information
about the source relations. In example when two relations are joined, their
schemas are merged, and we know which attributes belong to which relation.
- Add a code example (optional).