You are here

function heartbeat_schema in Heartbeat 6.3

Same name and namespace in other branches
  1. 8 heartbeat.install \heartbeat_schema()
  2. 6.4 heartbeat.install \heartbeat_schema()
  3. 7 heartbeat.install \heartbeat_schema()

Implementation of hook_schema().

File

./heartbeat.install, line 89

Code

function heartbeat_schema() {
  $schema['heartbeat_messages'] = array(
    'description' => t('Table that contains predefined messages that can be used in heartbeat views.'),
    'fields' => array(
      'hid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('Primary Key: Unique heartbeat_messages event ID.'),
      ),
      'message_id' => array(
        'type' => 'varchar',
        'length' => 250,
        'not null' => FALSE,
        'default' => '',
        'description' => t('The message id which is unique to identify activity.'),
      ),
      'message' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Text of log message to be passed into the t() function.'),
        'alias' => 'message_orig',
      ),
      'message_concat' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Text of translatable log message for in concatenated form.'),
        'alias' => 'message_concat_orig',
      ),
      'concat_args' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => t('Arguments for concatenation message.'),
      ),
      'message_type' => array(
        'type' => 'text',
        'size' => 'small',
        'description' => t('The heartbeat message type.'),
      ),
      'perms' => array(
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'tiny',
        'description' => t('Permissions for this message.'),
        'default' => 0,
      ),
      'custom' => array(
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'tiny',
        'description' => t('Custom message type.'),
        'default' => 0,
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => t('Description and/or help text.'),
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => 150,
        'not null' => FALSE,
        'default' => '',
        'description' => t('module where the message is defined.'),
      ),
      'variables' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => t('Variables to parse into the message (used in message).'),
      ),
    ),
    'primary key' => array(
      'hid',
    ),
    'indexes' => array(
      'message_id' => array(
        'message_id',
      ),
    ),
  );
  $schema['heartbeat_mt'] = array(
    'description' => t('Table links tags with messages to filter logging and viewing.'),
    'fields' => array(
      'mtid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('Primary Key: Unique  event ID - heartbeat message id.'),
      ),
      'htid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The heartbeat tag id to link to.'),
      ),
      'hid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The heartbeat message id to link to.'),
      ),
    ),
    'primary key' => array(
      'mtid',
    ),
    'indexes' => array(
      'htid' => array(
        'htid',
      ),
      'hid' => array(
        'hid',
      ),
    ),
  );
  $schema['heartbeat_tags'] = array(
    'description' => t('Table with heartbeat tags.'),
    'fields' => array(
      'htid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('Primary Key:heartbeat tag id.'),
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 150,
        'not null' => FALSE,
        'default' => '',
        'description' => t('Tag name.'),
      ),
    ),
    'primary key' => array(
      'htid',
    ),
    'indexes' => array(),
  );
  $schema['heartbeat_activity'] = array(
    'description' => t('Table that contains logs of all user triggerable actions.'),
    'fields' => array(
      'uaid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('Primary Key: Unique heartbeat_activity event ID.'),
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {users}.uid of the user who triggered the event (requester).'),
      ),
      'uid_target' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'default' => 0,
        'description' => t('The target User ID'),
      ),
      'nid_target' => array(
        'description' => t('The target Node ID.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'access' => array(
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'tiny',
        'description' => t('Access for this message to others.'),
        'default' => 0,
      ),
      'message_id' => array(
        'type' => 'varchar',
        'length' => 250,
        'not null' => FALSE,
        'default' => '',
        'description' => t('The message id which links to the heartbeat message.'),
      ),
      'message' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Text of log message to be passed into the t() function.'),
      ),
      'message_concat' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Concatenated, grouped or merged text of log message to be passed into the t() function.'),
      ),
      'timestamp' => array(
        'description' => t('The activity\'s unix timestamp when action occurred'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 12,
        'not null' => FALSE,
        'default' => 'en',
        'description' => t('language for a log".'),
      ),
      'variables' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => t('Serialized array of variables that match the message string and that is passed into the t() function.'),
      ),
    ),
    'primary key' => array(
      'uaid',
    ),
    'indexes' => array(
      'timestamp' => array(
        'timestamp',
      ),
      'uid' => array(
        'uid',
      ),
      'message_id' => array(
        'message_id',
      ),
      'uid_target' => array(
        'uid_target',
      ),
      'nid_target' => array(
        'nid_target',
      ),
      'language' => array(
        'language',
      ),
    ),
  );
  return $schema;
}