You are here

function biblio_pm_schema in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/pubmed/biblio_pm.install \biblio_pm_schema()
  2. 6 pubmed/biblio_pm.install \biblio_pm_schema()
  3. 7.2 modules/pubmed/biblio_pm.install \biblio_pm_schema()

Implementation of hook_schema().

Note: Pro Drupal Development models use of t() to translate 'description' for field definitions, but Drupal core does not use them. We follow core.

1 call to biblio_pm_schema()
biblio_pm_update_7004 in modules/pubmed/biblio_pm.install
Add a new table 'biblio_pubmed_grant_info'.

File

modules/pubmed/biblio_pm.install, line 50
Database table creation for biblio_pm module.

Code

function biblio_pm_schema() {
  $schema = array();
  $schema['biblio_pubmed'] = array(
    'fields' => array(
      'biblio_pubmed_id' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'biblio_pmcid' => array(
        'type' => 'varchar',
        'length' => 20,
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'biblio_pubmed_md5' => array(
        'type' => 'char',
        'length' => 32,
        'not null' => TRUE,
      ),
      'biblio_pm_changed' => array(
        'description' => 'The Unix timestamp when the pmid was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['biblio_pubmed_grant_info'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'biblio_pubmed_id' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'grantid' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'acronym' => array(
        'type' => 'varchar',
        'length' => 2,
      ),
      'agency' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'country' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}