Skip to content

Database Schema

Relationships are stored in a single table.

Table: wp_content_relations

The table name is prefixed with the WordPress table prefix (e.g. wp_content_relations).

ColumnTypeDescription
idbigintPrimary key
from_idbigintSource object ID
from_typevarcharpost, user, or term
to_idbigintTarget object ID
to_typevarcharpost, user, or term
typevarcharRelationship type slug
relation_orderintOptional manual order (when enabled)
created_atdatetimeCreation time

Indexes

  • Composite indexes on (from_id, type) and (to_id, type) for lookups by source or target.
  • Covering index type_lookup (type, from_id, to_id) for type-scoped queries and integrity checks.

Schema version

NCR_SCHEMA_VERSION (and the option ncr_schema_version) control when migrations run. Schema is stable in the 1.x line; changes are additive or migrated with a documented upgrade path.

Schema stable from 1.x onward. Backward compatibility guaranteed.