Core:Database Schema
From Habari Project
This page a brief overview of in Habari's database schema. Note: The schema below applies to revision 3749. The schema is also available as a schema diagram.
Contents |
These tables store data related to Habari's posts.
posts
The posts table represents Post objects. See the page on retrieving posts for information accessing them.
- id (Primary)
- slug
- content_type
- title
- guid
- content
- cached_content
- user_id
- status
- pubdate
- updated
- modified
postinfo
The postinfo table holds metadata related to individual posts. Read more about using metadata.
- post_id (Primary)
- name (Primary)
- type
- value
posttype
The posttype table stores the different content types that Habari knows about. By default this is entry and post, but more can be added.
- id (Primary)
- name
- active
poststatus
The poststatus table stores the different statuses that a post can have. By default this is draft, published and scheduled.
- id (Primary)
- name
- internal
These tables hold data about comments associated with Habari posts.
comments
The comments table represents Comment objects.
- id (Primary)
- post_id
- name
- url
- ip
- content
- status
- date
- type
commentinfo
The commentinfo table stores metadata about comments. The most common metadata associated with comments is related to spam filtering.
- comment_id (Primary)
- name (Primary)
- type
- value
These tables store data related to users that have accounts on this installation of Habari.
users
The users table represents User objects. One user with administration privileges will be created on install. Note that the anonymous user is a pseudo-user does not have an entry in the users table.
- id (Primary)
- username
- password
userinfo
Like postinfo, the userinfo table holds metadata about users. Options that are specific to a user should be stored here rather than in the options table.
- user_id (Primary)
- name (Primary)
- type
- value
sessions
Data about users' sessions is stored in the session table.
- token
- subnet
- expires
- ua
- user_id
- data
Habari's users are placed in groups.
groups
- id (Primary)
- name
users_groups
- id (Primary)
- user_id
- group_id
These tables store data about the Permissions that users and groups have.
tokens
- id (Primary)
- name
- description
- token_type
- token_group
post_tokens
- post_id (Primary)
- token_id (Primary)
group_token_permissions
- group_id (Primary)
- token_id (Primary)
- access_mask
user_token_permissions
- user_id (Primary)
- token_id (Primary)
- access_mask
With Habari's taxonomy system, objects can be related to each other. These tables store information about existing and possible relationships.
terms
- id (Primary)
- term
- term_display
- vocabulary_id
- mptt_left
- mptt_right
vocabularies
- id (Primary)
- name
- description
- hierarchical
- required
object_terms
- object_id (Primary)
- term_id (Primary_
- object_type_id
object_types
- id (Primary)
- name
Deprecated tag tables
Before moving to a taxonomy system, the tags and tag2post tables held data about tags and the posts to which they are attached. As of 0.7, they are no longer in use. They will be dropped in a future release.
tags
- id (Primary)
- tag_text
- tag_slug
tag2post
- tag_id (Primary)
- post_id (Primary)
scopes
- id (Primary)
- name
- criteria
- description
- priority
blocks
- id (Primary)
- title
- type
- data
blocks_areas
- id (Primary)
- block_id
- area
- scope_id
- display_order
These tables store information related to the entire site.
options
Settings that affect the entire site should be stored in the options table. For example, the site's title is stored here, as is the API and database version numbers. Plugin options are also stored here, with the name convention being classname__optionname. The type is automagically managed by the Options class, where 1 = serialized and 0 is not.
- name (Primary)
- type
- value
rewrite_rules
Habari's rewrite rules map URLs to actions. The default rewrite rules are set in code in the RewriteRule class, and can be manipulated and extended by plugins. The rewrite_rule table isn't used internally, but can be used to override rules added in code.
- rule_id (Primary)
- name
- parse_regex
- build_str
- handler
- action
- priority
- is_active
- rule_class
- description
- parameters
crontab
Habari has adopted Unix's terminology for a system to run periodic tasks. The crontab table holds information about the periodic tasks that Habari runs.
- cron_id (Primary)
- name
- callback
- last_run
- next_run
- increment
- start_time
- end_time
- result
- notify
- cron_class
- description
log
Habari can record information about events that occur during execution, and this information is stored in the log table.
- id (Primary)
- user_id
- type_id
- severity_id
- message
- data
- timestamp
- ip
log_types
- id (Primary)
- module
- type