function tmgmt_schema in Translation Management Tool 7
Implements hook_schema().
1 call to tmgmt_schema()
- _tmgmt_override_property_description in includes/
tmgmt.info.inc - Populates all entity property descriptions based on the schema definition.
File
- ./
tmgmt.install, line 20 - Installation hooks for the Translation Management module.
Code
function tmgmt_schema() {
$schema['tmgmt_job'] = array(
'description' => 'A translation job represents a translation order that can be assigned to a translator.',
'fields' => array(
'tjid' => array(
'description' => 'The identifier of the translation job.',
'type' => 'serial',
'not null' => TRUE,
),
'source_language' => array(
'description' => 'The source language of the data.',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
),
'target_language' => array(
'description' => 'The language the data should be translated to.',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
),
'state' => array(
'description' => 'The state of the translation job.',
'type' => 'int',
'not null' => TRUE,
),
'created' => array(
'description' => 'Created timestamp.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'changed' => array(
'description' => 'Changed timestamp.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'translator' => array(
'description' => 'Machine name of the translator.',
'type' => 'varchar',
'length' => 128,
),
'settings' => array(
'description' => 'Translator specific configuration and context for this job.',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
),
'reference' => array(
'description' => 'Remote identifier of this translation job.',
'type' => 'varchar',
'length' => 255,
),
'uid' => array(
'description' => 'uid of the job creator',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'label' => array(
'description' => 'Optional user provided label of the job.',
'type' => 'varchar',
'length' => 255,
),
),
'primary key' => array(
'tjid',
),
'indexes' => array(
'state' => array(
'state',
),
'reference' => array(
'reference',
),
),
);
$schema['tmgmt_remote'] = array(
'description' => 'TMGMT job remote mapping.',
'fields' => array(
'trid' => array(
'description' => 'The primary key.',
'type' => 'serial',
'not null' => TRUE,
),
'tjid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => '{tmgmt_job}.tjid foreign key',
),
'tjiid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => '{tmgmt_job_item}.tjjid foreign key',
),
'data_item_key' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Translation job data item key.',
),
'remote_identifier_1' => array(
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
'default' => '',
'description' => 'Custom remote identifier data.',
),
'remote_identifier_2' => array(
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
'default' => '',
'description' => 'Custom remote identifier data.',
),
'remote_identifier_3' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Custom remote identifier data.',
),
'remote_url' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Remote job url.',
),
'word_count' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Word count info provided by the remote service.',
),
'amount' => array(
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => 0,
'description' => 'Amount charged for the remote translation job.',
),
'currency' => array(
'type' => 'char',
'length' => 3,
'not null' => TRUE,
'default' => '',
'description' => 'Amount charged currency.',
),
'remote_data' => array(
'description' => 'Custom remote data.',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array(
'trid',
),
'indexes' => array(
'tjid' => array(
'tjid',
),
'tjiid' => array(
'tjiid',
),
'remote_identifiers' => array(
'remote_identifier_1',
'remote_identifier_2',
),
),
);
$schema['tmgmt_job_item'] = array(
'description' => 'A job item connects a source to a translation job.',
'fields' => array(
'tjiid' => array(
'description' => 'The identifier of the translation job item.',
'type' => 'serial',
'not null' => TRUE,
),
'tjid' => array(
'description' => 'The identifier of the translation job.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'plugin' => array(
'description' => 'Indicates the plugin which provides this item.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'item_type' => array(
'description' => 'The type of the item, e.g. the entity type.',
'type' => 'varchar',
'length' => 128,
),
'item_id' => array(
'description' => 'The unique id (within the given item type) of the item.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'state' => array(
'description' => 'The state of the translation job item.',
'type' => 'int',
'not null' => TRUE,
),
'data' => array(
'description' => 'Can be used by the source plugin to store the data if it can not be retrieved anymore later on.',
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'serialize' => TRUE,
),
'changed' => array(
'description' => 'Changed timestamp.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'count_pending' => array(
'description' => 'Counter for all pending 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_accepted' => array(
'description' => 'Counter for all accepted data items.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'count_reviewed' => array(
'description' => 'Counter for all reviewed data items.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'word_count' => array(
'description' => 'Word count of all texts contained in this job item.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'tjiid',
),
'indexes' => array(
'job_id' => array(
'tjid',
),
),
'foreign keys' => array(
'job' => array(
'table' => 'tmgmt_job',
'columns' => array(
'tjid',
),
),
),
);
$schema['tmgmt_translator'] = array(
'description' => 'A translator is a combination of a translator type and type specific configuration.',
'fields' => array(
'tid' => array(
'description' => 'The identifier of the translator.',
'type' => 'serial',
'not null' => TRUE,
),
'name' => array(
'description' => 'Machine name identifier of the translator.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'label' => array(
'description' => 'Label of the translator.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'description' => array(
'description' => 'Description of the translator.',
'type' => 'text',
'size' => 'medium',
),
'plugin' => array(
'description' => 'Name of the translator service plugin.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'settings' => array(
'description' => 'Translator specific settings.',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
),
'weight' => array(
'description' => 'The weight of the translator.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'The exportable status of the entity.',
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x1,
'size' => 'tiny',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array(
'tid',
),
'unique keys' => array(
'name' => array(
'name',
),
),
);
$schema['tmgmt_message'] = array(
'description' => 'A log message can be used to store events that affect a job.',
'fields' => array(
'mid' => array(
'description' => 'The identifier of the message.',
'type' => 'serial',
'not null' => TRUE,
),
'tjid' => array(
'description' => 'The identifier of the translation job that the message belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'tjiid' => array(
'description' => 'The identifier of the translation job item that the message belongs to.',
'type' => 'int',
'unsigned' => TRUE,
),
'uid' => array(
'description' => 'The identifier of the user who performed the action.',
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
),
'message' => array(
'description' => 'The language into the data should be translated.',
'type' => 'text',
'size' => 'big',
),
'variables' => array(
'description' => 'The variables of the message as expected by t().',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
),
'created' => array(
'description' => 'Created timestamp.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'Type of the message (debug, notice, warning or error)',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
),
'primary key' => array(
'mid',
),
'indexes' => array(
'tjid' => array(
'tjid',
),
'tjiid' => array(
'tjiid',
),
),
);
// Clone the schema for our cache table from Drupal core.
$schema['cache_tmgmt'] = drupal_get_schema_unprocessed('system', 'cache');
// Clone the schema for the entity cache module if it is enabled.
if (module_exists('entitycache')) {
$schema['cache_entity_tmgmt_translator'] = drupal_get_schema_unprocessed('system', 'cache');
}
return $schema;
}