thomshouse/escher — Issue #41: Revamp model metadata and content
Author: thomshouse
Created: 2012-01-26 02:56:30+00:00
State: open
Labels: Planned

Metadata and content values are currently stored as EAVs in unstructured tables. This is an anti-pattern that imposes severe limitations on the ability to access and manipulate these fields at an SQL level.

Propose to instead move to a consistent, one-model-per-row approach for metadata and content tables just as it is for a model's primary table. Storage location for a field will be determined by the schema:

* TEXT/BLOB and related fields will always go into `model_content`.
* Fields flagged as `"metadata" => TRUE` will be stored in `model_metadata`.
* All other fields defined in the model schema will simply go into the main `model` table.

This behavior will be partially reversed for fields registered via plugin hooks:

* Fields must be explicitly flagged as `"metadata" => FALSE` in ordered to be stored in `model`; by default, they will be stored in `model_metadata`.
* Additionally, hooked fields **will not** be able to override/alter a default model schema field, to preserve the default data and functionality of the model.