You are here

function activity_schema in Activity 6

Same name and namespace in other branches
  1. 8 activity.install \activity_schema()
  2. 6.2 activity.install \activity_schema()
  3. 7 activity.install \activity_schema()

Implementation of hook_schema().

File

./activity.install, line 11
Install file for activity module.

Code

function activity_schema() {
  $schema['activity'] = array(
    'description' => t('The {activity} table stores activity data'),
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 25,
        'not null' => TRUE,
        'default' => '',
      ),
      'operation' => array(
        'type' => 'varchar',
        'length' => 25,
        'not null' => TRUE,
        'default' => '',
      ),
      'created' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'data' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'module' => array(
        'module',
      ),
      'created' => array(
        'created',
      ),
    ),
  );
  $schema['activity_targets'] = array(
    'description' => t('The {activity_targets} table stores activity target data'),
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'target_uid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'target_role' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'aid',
      'target_uid',
    ),
    'indexes' => array(
      'target_uid_target_role' => array(
        'target_uid',
        'target_role',
      ),
      'target_role' => array(
        'target_role',
      ),
    ),
  );
  $schema['activity_comments'] = array(
    'description' => t('Store comments left on an activity ID.'),
    'fields' => array(
      'acid' => array(
        'description' => t('The unique ID that represents this comment.'),
        'not null' => TRUE,
        'type' => 'serial',
      ),
      'aid' => array(
        'default' => 0,
        'description' => t('The {activity}.aid that represents this activity.'),
        'not null' => TRUE,
        'type' => 'int',
      ),
      'uid' => array(
        'default' => 0,
        'description' => t('The {users}.uid of the user leaving a comment on this activity.'),
        'not null' => TRUE,
        'type' => 'int',
      ),
      'timestamp' => array(
        'default' => 0,
        'description' => t('The time the comment was created, as a Unix timestamp.'),
        'not null' => TRUE,
        'type' => 'int',
      ),
      'comment' => array(
        'description' => t('The comment body.'),
        'not null' => TRUE,
        'size' => 'big',
        'type' => 'text',
      ),
    ),
    'primary key' => array(
      'acid',
    ),
    'indexes' => array(
      'aid' => array(
        'aid',
      ),
      'uid' => array(
        'uid',
      ),
    ),
  );
  return $schema;
}