You are here

function biblio_update_6013 in Bibliography Module 6.2

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

Update ...

This update function ...

Return value

array An array of associative arrays with 'success' and 'query' keys.

File

./biblio.install, line 2165
Install, update, and uninstall functions for the 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;
}