function biblio_update_6000 in Bibliography Module 6.2
Same name and namespace in other branches
- 6 biblio.install \biblio_update_6000()
Update ...
This update function ...
Return value
array An array of associative arrays with 'success' and 'query' keys.
File
- ./
biblio.install, line 2093 - Install, update, and uninstall functions for the biblio module.
Code
function biblio_update_6000() {
$result = array();
$schema = biblio_schema();
// modifications to biblio main table
db_add_field($result, 'biblio', 'biblio_md5', array(
'type' => 'varchar',
'length' => '32',
));
db_add_index($result, 'biblio', 'md5', array(
'biblio_md5',
));
$result[] = update_sql("ALTER TABLE {biblio} MODIFY biblio_year int NOT NULL DEFAULT '9999' ");
$result[] = update_sql("ALTER TABLE {biblio} MODIFY biblio_citekey varchar(255) ");
$result[] = update_sql("CREATE TABLE {biblio_u5} (\n `upgrade from 5` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\n PRIMARY KEY (`upgrade from 5`))");
// move biblio_fields to biblio_fields_old for later usage
$result[] = update_sql("ALTER TABLE {biblio_fields} RENAME TO {biblio_fields_old}");
$result[] = update_sql("UPDATE {biblio_fields_old} SET name='biblio_corp_authors' WHERE name='biblio_corp_author'");
// drop obsolete tables
db_drop_table($result, 'biblio_author_index');
db_drop_table($result, 'biblio_has_author');
// create new tables
db_create_table($result, 'biblio_fields', $schema['biblio_fields']);
db_create_table($result, 'biblio_field_type', $schema['biblio_field_type']);
db_create_table($result, 'biblio_field_type_data', $schema['biblio_field_type_data']);
db_create_table($result, 'biblio_contributor', $schema['biblio_contributor']);
db_create_table($result, 'biblio_contributor_data', $schema['biblio_contributor_data']);
db_create_table($result, 'biblio_contributor_type', $schema['biblio_contributor_type']);
db_create_table($result, 'biblio_contributor_type_data', $schema['biblio_contributor_type_data']);
db_create_table($result, 'biblio_keyword', $schema['biblio_keyword']);
db_create_table($result, 'biblio_keyword_data', $schema['biblio_keyword_data']);
db_create_table($result, 'biblio_collection', $schema['biblio_collection']);
db_create_table($result, 'biblio_collection_type', $schema['biblio_collection_type']);
db_create_table($result, 'biblio_duplicates', $schema['biblio_duplicates']);
// Fill the biblio_field* tables with default definition records.
$result[] = _biblio_add_field_definitions();
$result[] = _biblio_types_customize_fields();
// move data
_biblio_move_field_data($result);
_biblio_move_authors($result);
db_drop_table($result, 'biblio_fields_old');
db_drop_table($result, 'biblio_type_details');
$result[] = biblio_md5_generate();
return $result;
}