function flag_schema in Flag 7.2
Same name and namespace in other branches
- 8.4 flag.install \flag_schema()
- 6.2 flag.install \flag_schema()
- 6 flag.install \flag_schema()
- 7.3 flag.install \flag_schema()
Implements hook_schema().
File
- ./
flag.install, line 143 - Flag module install/schema/update hooks.
Code
function flag_schema() {
$schema = array();
$schema['flags'] = array(
'description' => 'All available flags in the system.',
'fields' => array(
'fid' => array(
'description' => 'The unique ID for this particular flag.',
'type' => 'serial',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
),
'content_type' => array(
'description' => 'The flag type, such as one of "node", "comment", or "user".',
'type' => 'varchar',
'length' => '32',
'not null' => TRUE,
'default' => '',
),
'name' => array(
'description' => 'The machine-name for this flag.',
'type' => 'varchar',
'length' => '128',
'not null' => FALSE,
'default' => '',
),
'title' => array(
'description' => 'The human-readable title for this flag.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
'default' => '',
),
'global' => array(
'description' => 'Whether this flag state should act as a single toggle to all users across the site.',
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => 0,
),
'options' => array(
'description' => 'The options and configuration of this flag.',
'type' => 'text',
'not null' => FALSE,
),
),
'primary key' => array(
'fid',
),
'unique keys' => array(
'name' => array(
'name',
),
),
);
$schema['flag_content'] = array(
'description' => 'Content that has been flagged.',
'fields' => array(
'fcid' => array(
'description' => 'The unique ID for this particular tag.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'fid' => array(
'description' => 'The unqiue flag ID this content has been flagged with, from {flags}.',
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'content_type' => array(
'description' => 'The flag type, one of "node", "comment", "user".',
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'default' => '',
),
'content_id' => array(
'description' => 'The unique ID of the content, such as either the {cid}, {uid}, or {nid}.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'The user ID by whom this content was flagged.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'sid' => array(
'description' => "The user's session id as stored in the session table.",
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'timestamp' => array(
'description' => 'The UNIX time stamp representing when the flag was set.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-size' => 11,
),
),
'primary key' => array(
'fcid',
),
'unique keys' => array(
'fid_content_id_uid_sid' => array(
'fid',
'content_id',
'uid',
'sid',
),
),
'indexes' => array(
'content_type_uid_sid' => array(
'content_type',
'uid',
'sid',
),
'content_type_content_id_uid_sid' => array(
'content_type',
'content_id',
'uid',
'sid',
),
'content_id_fid' => array(
'content_id',
'fid',
),
),
);
$schema['flag_types'] = array(
'description' => 'The types (usually as defined in {node_type}) that are affected by a flag.',
'fields' => array(
'fid' => array(
'description' => 'The unqiue flag ID as defined for the flag in {flags}.',
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'type' => array(
'description' => 'The types (usually from {node_type}) that can be flagged by this fid.',
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'fid' => array(
'fid',
),
),
);
$schema['flag_counts'] = array(
'description' => 'The number of times an item has been flagged.',
'fields' => array(
'fid' => array(
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'content_type' => array(
'description' => 'The flag type, usually one of "node", "comment", "user".',
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'default' => '',
),
'content_id' => array(
'description' => 'The unique ID of the content, usually either the {cid}, {uid}, or {nid}.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
'count' => array(
'description' => 'The number of times this content has been flagged for this flag.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
'last_updated' => array(
'description' => 'The UNIX time stamp representing when the flag was last updated.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-size' => 11,
),
),
'primary key' => array(
'fid',
'content_id',
),
'indexes' => array(
'fid_content_type' => array(
'fid',
'content_type',
),
'content_type_content_id' => array(
'content_type',
'content_id',
),
'fid_count' => array(
'fid',
'count',
),
'fid_last_updated' => array(
'fid',
'last_updated',
),
),
);
return $schema;
}