You are here

function tmgmt_local_schema in Translation Management Tool 7

Implements hook_schema().

File

translators/tmgmt_local/tmgmt_local.install, line 11
Installation hooks for tmgmt_local module.

Code

function tmgmt_local_schema() {
  $schema['tmgmt_local_task'] = array(
    'description' => 'A tmgmt local task connects translator user with assigned job items and provide additional workflow data.',
    'fields' => array(
      'tltid' => array(
        'description' => 'The identifier of the task.',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "User's {users}.uid for task creator.",
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the task was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the task was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'title' => array(
        'description' => 'Task title.',
        'type' => 'varchar',
        'length' => 128,
      ),
      'tuid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Assigned translator user {users}.uid.',
      ),
      'tjid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Translation job {tmgmt_job}.tjid that belongs to task.",
      ),
      'status' => array(
        'description' => 'The status of the task.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'loop_count' => array(
        'description' => 'Counter for how many times this task was returned to translator.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tltid',
    ),
    'indexes' => array(
      'tuid' => array(
        'tuid',
      ),
    ),
    'foreign keys' => array(
      'author' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
      'translator' => array(
        'table' => 'users',
        'columns' => array(
          'tuid' => 'uid',
        ),
      ),
      'job' => array(
        'table' => 'tmgmt_job',
        'columns' => array(
          'tjid' => 'tjid',
        ),
      ),
    ),
  );
  $schema['tmgmt_local_task_item'] = array(
    'description' => 'A tmgmt local task item contains additional workflow data for a job item.',
    'fields' => array(
      'tltiid' => array(
        'description' => 'The identifier of the task item.',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'tltid' => array(
        'description' => 'Translation job task {tmgmt_local_task}.tltid that belongs to task.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'tjiid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Translation job item {tmgmt_job_item}.tjiid that belongs to task.",
      ),
      'status' => array(
        'description' => 'The status of the task.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => 'Stores translations and translation statuses',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'serialize' => TRUE,
      ),
      'count_untranslated' => array(
        'description' => 'Counter for all untranslated data items.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'count_translated' => array(
        'description' => 'Counter for all translated data items.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'count_completed' => array(
        'description' => 'Counter for all completed data items.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tltiid',
    ),
    'indexes' => array(
      'tltid' => array(
        'tltid',
      ),
    ),
    'foreign keys' => array(
      'task' => array(
        'table' => 'tmgmt_local_task',
        'columns' => array(
          'tltid' => 'tltid',
        ),
      ),
      'job_item' => array(
        'table' => 'tmgmt_job_item',
        'columns' => array(
          'tjiid' => 'tjiid',
        ),
      ),
    ),
  );
  return $schema;
}