function biblio_update_6000 in Bibliography Module 6
Same name and namespace in other branches
- 6.2 biblio.install \biblio_update_6000()
File
- ./
biblio.install, line 1557 - Install file for 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 biblio_field* tables with defaults
$result[] = _add_db_field_data();
$result[] = _add_custom_field_data();
// move data
_move_field_data($result);
_move_authors($result);
db_drop_table($result, 'biblio_fields_old');
db_drop_table($result, 'biblio_type_details');
$result[] = biblio_md5_generate();
return $result;
}