You are here

function casetracker_schema in Case Tracker 7

Same name and namespace in other branches
  1. 6 casetracker.install \casetracker_schema()
  2. 7.2 casetracker.install \casetracker_schema()

Implements hook_schema().

File

./casetracker.install, line 12
Install, update and uninstall functions for the casetracker module.

Code

function casetracker_schema() {
  $schema['casetracker_case'] = array(
    'fields' => array(
      'nid' => array(
        'description' => 'The {node} the case relates to.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'vid' => array(
        'description' => 'The {node_revision} for the case.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'description' => 'The project {node} the case is related to.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_number' => array(
        'description' => 'the case number of this node (namespaced per projects). Deprecated.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'assign_to' => array(
        'description' => 'The {user} that the case is assigned to.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_priority_id' => array(
        'description' => 'The {casetracker_case_states} that describes the case priority.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_type_id' => array(
        'description' => 'The {casetracker_case_states} that describes the case type.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_status_id' => array(
        'description' => 'Store the {casetracker_case_states} that describes the case status.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'p_id' => array(
        'pid',
      ),
    ),
    'primary key' => array(
      'vid',
    ),
  );
  $schema['casetracker_case_states'] = array(
    'fields' => array(
      'csid' => array(
        'description' => 'unique ID of this case state.',
        'type' => 'serial',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'case_state_name' => array(
        'description' => 'name of this case state.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'case_state_realm' => array(
        'description' => 'the realm ("priority", etc.) of this state.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'description' => 'The weight of an case state.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'weight' => array(
        'weight',
      ),
    ),
    'primary key' => array(
      'csid',
    ),
  );
  $schema['casetracker_comment_status'] = array(
    'fields' => array(
      'cid' => array(
        'description' => 'Store the {comment} that the record relates to.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'description' => 'Store the {project} that the record relates to.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'title' => array(
        'description' => 'Title of the case.',
        'type' => 'varchar',
        'length' => 250,
        'not null' => FALSE,
      ),
      'assign_to' => array(
        'description' => 'The {user} too whom the case is assigned.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_priority_id' => array(
        'description' => 'The {casetracker_case_states} that describes the case priority.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_type_id' => array(
        'description' => 'The {casetracker_case_states} that describes the case type.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'case_status_id' => array(
        'description' => 'Store the {casetracker_case_states} that describes the case status.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'state' => array(
        'description' => 'Record whether the row is for the "before" the comment (0) or "after" (1).',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'cid' => array(
        'cid',
      ),
    ),
  );
  return $schema;
}