The database contains a number of primary tables and secondary tables. Its schema table is stored in /engine/schema/mysql.sql.
Each table is prefixed by "prefix_", this is replaced by the Elgg framework during installation.
Main tables
This is a description of the main tables. Keep in mind that in a given Elgg installation, the tables will have a prefix (typically "elgg_").
entities
This is the main Elgg entity table containing Elgg users, sites, objects and groups. When you first install Elgg this is automatically populated with your first site.
It contains the following fields:
- guid
- An auto-incrementing counter producing a GUID that uniquely identifies this entity in the system.
- type
- The type of entity - object, user, group or site
- subtype
- A link to the subtype table.
- owner_guid
- The GUID of the owner's entity.
- site_guid
- The site the entity belongs to.
- container_guid
- The GUID this entity is contained by - either a user or a group.
- access_id
- Access controls on this entity.
- time_created
- Unix timestamp of when the entity is created.
- time_updated
- Unix timestamp of when the entity was updated.
- enabled
- If this is 'yes' an entity is accessible, if 'no' the entity has been disabled (Elgg treats it as if it were deleted without actually removing it from the database).
entity_subtypes
This table contains entity subtype information:
- id A counter.
- type The type of entity - object, user, group or site.
- subtype The subtype name as a string.
- class Optional class name if this subtype is linked with a class
metadata
This table contains extra information attached to an entity.
- id A counter.
- entity_guid The entity this is attached to.
- name_id A link to the metastrings table defining the name table.
- value_id A link to the metastrings table defining the value.
- value_type The value class, either text or an integer.
- owner_guid The owner GUID of the owner who set this item of metadata.
- access_id An Access controls on this item of metadata.
- time_created Unix timestamp of when the metadata is created.
- enabled If this is 'yes' an item is accessible, if 'no' the item has been deleted.
annotations
This table contains annotations, this is distinct from metadata.
- id A counter.
- entity_guid The entity this is attached to.
- name_id A link to the metastrings table defining the type of annotation.
- value_id A link to the metastrings table defining the value.
- value_type The value class, either text or an integer.
- owner_guid The owner GUID of the owner who set this item of metadata.
- access_id An Access controls on this item of metadata.
- time_created Unix timestamp of when the metadata is created.
- enabled If this is 'yes' an item is accessible, if 'no' the item has been deleted.
relationships
This table defines relationships, these link one entity with another.
objects_entity
Extra information specifically relating to objects. These are split in order to reduce load on the metadata table and make an obvious difference between attributes and metadata.
sites_entity
Extra information specifically relating to sites. These are split in order to reduce load on the metadata table and make an obvious difference between attributes and metadata.
users_entity
Extra information specifically relating to users. These are split in order to reduce load on the metadata table and make an obvious difference between attributes and metadata.
groups_entity
Extra information specifically relating to groups. These are split in order to reduce load on the metadata table and make an obvious difference between attributes and metadata.
metastrings
Metastrings contain the actual string of metadata which is linked to by the metadata and annotations tables.
This is to avoid duplicating strings, saving space and making database lookups more efficient.
Core developers will place schema upgrades in /engine/schema/upgrades/*.