You are here

function biblio_schema in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 biblio.install \biblio_schema()
  2. 7.3 biblio.install \biblio_schema()
  3. 7 biblio.install \biblio_schema()
  4. 7.2 biblio.install \biblio_schema()
7 calls to biblio_schema()
biblio_reset_types in ./biblio.install
biblio_update_6000 in ./biblio.install
biblio_update_6011 in ./biblio.install
biblio_update_6025 in ./biblio.install
_add_custom_field_data in ./biblio.install

... See full list

File

./biblio.install, line 220
Install file for biblio module

Code

function biblio_schema() {
  $schema['biblio'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => '',
      ),
      'vid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => '',
      ),
      'biblio_type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => '',
      ),
      'biblio_number' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_other_number' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_secondary_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_tertiary_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_edition' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_publisher' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_place_published' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_year' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 9999,
        'description' => '',
      ),
      'biblio_volume' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_pages' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_date' => array(
        'type' => 'varchar',
        'length' => '16',
        'description' => '',
      ),
      'biblio_isbn' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_lang' => array(
        'type' => 'varchar',
        'length' => '24',
        'default' => 'eng',
        'description' => '',
      ),
      'biblio_abst_e' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_abst_f' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_full_text' => array(
        'type' => 'int',
        'default' => 0,
        'description' => '',
      ),
      'biblio_url' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_issue' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_type_of_work' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_accession_number' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_call_number' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_notes' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom1' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom2' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom3' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom4' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom5' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom6' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_custom7' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_research_notes' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_number_of_volumes' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_short_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_alternate_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_original_publication' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_reprint_edition' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_translated_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_section' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_citekey' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_coins' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_doi' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_issn' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => '',
      ),
      'biblio_auth_address' => array(
        'type' => 'text',
        'description' => '',
      ),
      'biblio_remote_db_name' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_remote_db_provider' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_label' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_access_date' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => '',
      ),
      'biblio_refereed' => array(
        'type' => 'varchar',
        'length' => '20',
        'description' => '',
      ),
      'biblio_md5' => array(
        'type' => 'varchar',
        'length' => '32',
        'description' => '',
      ),
    ),
    'primary key' => array(
      'vid',
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'md5' => array(
        'biblio_md5',
      ),
      'year' => array(
        'biblio_year',
      ),
    ),
  );
  $schema['biblio_fields'] = array(
    'fields' => array(
      'fid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{biblio_fields}.fid of the node',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => '',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => 'textfield',
      ),
      'size' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 60,
      ),
      'maxsize' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 255,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
  );
  $schema['biblio_field_type'] = array(
    'description' => 'Relational table linking {biblio_fields} with {biblio_field_type_data}',
    'fields' => array(
      'tid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{biblio_types}.tid of the node',
      ),
      'fid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{biblio_fields}.fid of the node',
      ),
      'ftdid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{biblio_field_type_data}.ftdid of the node, points to the current data, default or custom',
      ),
      'cust_tdid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'This always points to the custom data for this field. Stored so we can switch back an forth between default and custom',
      ),
      'common' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'autocomplete' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'required' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'Is input required for this field',
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The weight (location) of the field on the input form',
      ),
      'visible' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'Determines if the field is visible on the input form',
      ),
    ),
    'primary key' => array(
      'tid',
      'fid',
    ),
    'indexes' => array(
      'tid' => array(
        'tid',
      ),
    ),
  );
  $schema['biblio_field_type_data'] = array(
    'description' => 'Data used to build the form elements on the input form',
    'fields' => array(
      'ftdid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{biblio_field_type_data}.ftdid of the node',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => '',
        'description' => 'The title, which will be displayed on the form, for a given field',
      ),
      'hint' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'The hint text printed below the input widget',
      ),
    ),
    'primary key' => array(
      'ftdid',
    ),
  );
  $schema['biblio_types'] = array(
    'fields' => array(
      'tid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => '{biblio_types}.tid of the publication type',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '64',
        'not null' => TRUE,
        'default' => '',
        'description' => 'The name of the publication type',
      ),
      'description' => array(
        'type' => 'varchar',
        'not null' => FALSE,
        'length' => '255',
        'description' => 'Description of the publication type',
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Controls the order the types are listed in',
      ),
      'visible' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 1,
        'description' => 'Determines if the publication type is visible in the list',
      ),
    ),
    'primary key' => array(
      'tid',
    ),
  );
  $schema['biblio_contributor'] = array(
    'description' => 'Relational table linking authors to biblio entries',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{node}.nid of the node',
      ),
      'vid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{node}.vid of the node',
      ),
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '{biblio_contributor_data}.cid of the node',
      ),
      'auth_type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 1,
        'description' => '{biblio_contributor_type}.auth_type of the node',
      ),
      'auth_category' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 1,
        'description' => '',
      ),
      'rank' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'Position of the author name on the publication (first,second,third...)',
      ),
    ),
    'primary key' => array(
      'vid',
      'cid',
      'auth_type',
      'rank',
    ),
  );
  $schema['biblio_contributor_data'] = array(
    'description' => 'Contains Author information for each publication',
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'Primary Key: Author ID',
      ),
      'aka' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'unsigned' => TRUE,
        'description' => 'Also known as, links this author entry with others so you can have variation on the name, but listing by cid will find all other (aka) author entries',
      ),
      'drupal_uid' => array(
        'type' => 'int',
        'not null' => FALSE,
        'unsigned' => TRUE,
        'description' => 'Drupal User ID',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Author last name',
      ),
      'lastname' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Author last name',
      ),
      'firstname' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => FALSE,
        'default' => '',
        'description' => 'Author first name',
      ),
      'prefix' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => FALSE,
        'default' => '',
        'description' => 'Author name prefix',
      ),
      'suffix' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => FALSE,
        'default' => '',
        'description' => 'Author name suffix',
      ),
      'initials' => array(
        'type' => 'varchar',
        'length' => '10',
        'not null' => FALSE,
        'default' => '',
        'description' => 'Author initials (including first name initial)',
      ),
      'affiliation' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
        'default' => '',
        'description' => 'Author affiliation or address',
      ),
      'md5' => array(
        'type' => 'varchar',
        'length' => '32',
        'not null' => FALSE,
        'description' => '',
      ),
    ),
    'primary key' => array(
      'cid',
      'aka',
    ),
    'indexes' => array(
      'lastname' => array(
        'lastname',
      ),
      'firstname' => array(
        'firstname',
      ),
      'initials' => array(
        'initials',
      ),
    ),
  );
  $schema['biblio_contributor_type'] = array(
    'description' => 'Contains definitions of the contributor types',
    'fields' => array(
      'auth_category' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'There are 5 catagoies of author: Primary, Secondary, Tertiery, Subsidary and Corporate  ',
      ),
      'biblio_type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '',
      ),
      'auth_type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'This is the pulication type specific verion of a particular catagory',
      ),
    ),
    'primary key' => array(
      'auth_category',
      'biblio_type',
      'auth_type',
    ),
  );
  $schema['biblio_contributor_type_data'] = array(
    'description' => 'Data used to build the form elements on the input form',
    'fields' => array(
      'auth_type' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => '{biblio_contributor_type_data} ctdid of the node',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => '128',
        'not null' => TRUE,
        'default' => '',
        'description' => 'The title, which will be displayed on the form, for a given field',
      ),
      'hint' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'The hint text printed below the input widget',
      ),
    ),
    'primary key' => array(
      'auth_type',
    ),
  );
  $schema['biblio_keyword'] = array(
    'description' => t('Relational table linking keywords to biblio nodes'),
    'fields' => array(
      'kid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {biblio_keyword_data}.kid of the keyword of the node '),
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('The {node}.nid of the node.'),
      ),
      'vid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {node}.vid of the node.'),
      ),
    ),
    'primary key' => array(
      'kid',
      'vid',
    ),
    'indexes' => array(
      'vid' => array(
        'vid',
      ),
      'nid' => array(
        'nid',
      ),
    ),
  );
  $schema['biblio_keyword_data'] = array(
    'description' => t('Stores the keywords related to nodes.'),
    'fields' => array(
      'kid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => t('Primary Key: The id of the keyword assigned to the node '),
      ),
      'word' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('The keyword'),
      ),
    ),
    'primary key' => array(
      'kid',
    ),
    'indexes' => array(
      'kword' => array(
        'word',
      ),
    ),
  );
  $schema['biblio_collection'] = array(
    'description' => t('Relational table grouping biblio nodes into collections'),
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {biblio_collection_data}.cid of the collection'),
      ),
      'vid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {node}.vid of the node.'),
      ),
      'pid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('The parent id of the collection'),
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('The {node}.nid of the node.'),
      ),
    ),
    'primary key' => array(
      'cid',
      'vid',
    ),
    'indexes' => array(
      'pid' => array(
        'pid',
      ),
      'nid' => array(
        'nid',
      ),
    ),
  );
  $schema['biblio_collection_type'] = array(
    'description' => t('Descriptions of the collections.'),
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The id of the collection '),
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('The name of the collection'),
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('The description of the collection'),
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['biblio_duplicates'] = array(
    'description' => t('Relational table linking possible duplicate biblio nodes'),
    'fields' => array(
      'vid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {biblio}.nid of the original node '),
      ),
      'did' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('The {biblio}.nid of the newly imported node which may be a duplicate.'),
      ),
      'type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('The type of duplicate 0=biblio, 1=author.'),
      ),
    ),
    'primary key' => array(
      'vid',
      'did',
    ),
    'indexes' => array(
      'did' => array(
        'vid',
      ),
    ),
  );
  $schema['biblio_import_cache'] = array(
    'description' => 'tables used for caching data imported from file and then batch processed',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'session_id' => array(
        'type' => 'varchar',
        'length' => 45,
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => t('A collection of data to cache.'),
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['biblio_type_maps'] = array(
    'description' => 'Table used to store the mapping information between various file formats and the biblio schema',
    'fields' => array(
      'format' => array(
        'description' => 'The import/export file format',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'type_map' => array(
        'description' => 'The mapping between the publication types in the file format and biblio',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'type_names' => array(
        'description' => 'The human readable names of the publication types',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'field_map' => array(
        'description' => 'The mapping between the fields in the file format and biblio',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'format',
    ),
  );
  return $schema;
}