You are here

function biblio_update_6013 in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 biblio.install \biblio_update_6013()

File

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

Code

function biblio_update_6013() {
  $result = array();
  if (!db_column_exists('biblio_contributor', 'auth_category')) {

    // we don't need to do this if upgrading from 5.x
    db_add_field($result, 'biblio_contributor', 'auth_category', array(
      'type' => 'int',
      'not null' => TRUE,
      'unsigned' => TRUE,
      'default' => 1,
    ));
    $result[] = update_sql("UPDATE {biblio} b\n                          INNER JOIN {biblio_contributor} bc on b.vid = bc.vid\n                          LEFT JOIN  {biblio_contributor_type} bct on b.biblio_type = bct.biblio_type and bct.auth_type = bc.auth_type\n                          SET bc.auth_category=bct.auth_catagory");
    $result[] = update_sql("ALTER TABLE {biblio_contributor_type} CHANGE COLUMN auth_catagory auth_category INTEGER UNSIGNED NOT NULL DEFAULT 0,\n                          DROP PRIMARY KEY,\n                          ADD PRIMARY KEY USING BTREE(auth_category, biblio_type, auth_type)");
  }
  $result[] = update_sql("UPDATE {biblio_fields} SET maxsize=20 WHERE name='biblio_year'");
  return $result;
}