function tripal_bulk_loader_schema

2.x tripal_bulk_loader.install tripal_bulk_loader_schema()
3.x tripal_bulk_loader.install tripal_bulk_loader_schema()
1.x tripal_bulk_loader.install tripal_bulk_loader_schema()

Implements hook_schema().

Creates the following tables in the Drupal database:

  • tripal_bulk_loader: Stores extra details for bulk loading jobs (nodes)
  • tripal_bulk_loader_template: Stores all loading templates
  • tripal_bulk_loader_inserted: Keeps track of all records inserted for a given bulk loading job

Related topics

2 calls to tripal_bulk_loader_schema()

File

tripal_bulk_loader/tripal_bulk_loader.install, line 36
Install/Uninstalls, Enables/Disables this module.

Code

function tripal_bulk_loader_schema() {
  $schema = array();
  $schema['tripal_bulk_loader'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'loader_name' => array(
        'type' => 'varchar',
      ),
      'template_id' => array(
        'type' => 'int',
      ),
      'file' => array(
        'type' => 'varchar',
        'not null' => TRUE
      ),
      'job_id' => array(
        'type' => 'int',
      ),
      'job_status' => array(
        'type' => 'varchar',
      ),
      'file_has_header' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'keep_track_inserted' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1
      ),
    ),
    'primary key' => array('nid'),
    'unique keys' => array(
      'name' => array('loader_name')
    ),
  );
  $schema['tripal_bulk_loader_template'] = array(
    'fields' => array(
      'template_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
      ),
      'template_array' => array(
        'type' => 'varchar',
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the template was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the template was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      )
    ),
    'primary key' => array('template_id'),
    'unique keys' => array(
      'name' => array('name')
    ),
  );
  $schema['tripal_bulk_loader_inserted'] = array(
    'fields' => array(
      'tripal_bulk_loader_inserted_id' => array(
        'type' => 'serial',
        'not null' => TRUE
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'table_inserted_into' => array(
        'type' => 'varchar',
        'not null' => TRUE,
      ),
      'table_primary_key' => array(
        'type' => 'varchar',
        'not null' => TRUE,
      ),
      'ids_inserted' => array(
        'type' => 'text',
        'not null' => TRUE
      ),
    ),
    'primary key' => array('tripal_bulk_loader_inserted_id'),
  );
  $schema['tripal_bulk_loader_constants'] = array(
    'fields' => array(
      'constant_id' => array(
        'type' => 'serial',
        'not null' => TRUE
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'group_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0
      ),
      'chado_table' => array(
        'type' => 'varchar',
        'not null' => TRUE,
      ),
      'chado_field' => array(
        'type' => 'varchar',
        'not null' => TRUE,
      ),
      'record_id' => array(
        'type' => 'int',
        'not null' => TRUE
      ),
      'field_id' => array(
        'type' => 'int',
        'not null' => TRUE
      ),
      'value' => array(
        'type' => 'text',
      ),
    ),
    'primary key' => array('constant_id'),
  );

  return $schema;
}