summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.install
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-02-03 18:16:23 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-02-03 18:16:23 +0000
commitec407ec945da8b7afee5c20f16cac6c041db1e25 (patch)
tree7fc94e0c97a2a7c3a69fd8527a2b939cf6bb70ef /modules/taxonomy/taxonomy.install
parent59c9219fb7b91a9d159709fd04e81969a610c8cd (diff)
downloadbrdo-ec407ec945da8b7afee5c20f16cac6c041db1e25.tar.gz
brdo-ec407ec945da8b7afee5c20f16cac6c041db1e25.tar.bz2
#211182 by Damien Tournoud, David_Rothstein, clemens.tolboom, scor, hunmonk, et al: Allow updates to specify dependencies to ensure they run in a predictable order.
Diffstat (limited to 'modules/taxonomy/taxonomy.install')
-rw-r--r--modules/taxonomy/taxonomy.install67
1 files changed, 48 insertions, 19 deletions
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index a4408bb93..d84797fcb 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -206,30 +206,59 @@ function taxonomy_schema() {
}
/**
+ * Implements hook_update_dependencies().
+ */
+function taxonomy_update_dependencies() {
+ // Taxonomy update 7002 creates comment Field API bundles and therefore must
+ // run after the Field module has been enabled, but before upgrading field
+ // data.
+ $dependencies['taxonomy'][7002] = array(
+ 'system' => 7049,
+ );
+ $dependencies['system'][7050] = array(
+ 'taxonomy' => 7002,
+ );
+ // It also must run before nodes are upgraded to use the Field API.
+ $dependencies['node'][7006] = array(
+ 'taxonomy' => 7002,
+ );
+ return $dependencies;
+}
+
+/**
+ * Rename taxonomy tables.
+ */
+function taxonomy_update_7001() {
+ db_rename_table('term_data', 'taxonomy_term_data');
+ db_rename_table('term_hierarchy', 'taxonomy_term_hierarchy');
+ db_rename_table('term_node', 'taxonomy_term_node');
+ db_rename_table('term_relation', 'taxonomy_term_relation');
+ db_rename_table('term_synonym', 'taxonomy_term_synonym');
+ db_rename_table('vocabulary', 'taxonomy_vocabulary');
+ db_rename_table('vocabulary_node_types', 'taxonomy_vocabulary_node_type');
+}
+
+/**
* Add {vocabulary}.machine_name column.
*/
function taxonomy_update_7002() {
- if (!variable_get('taxonomy_update_7002_done', FALSE)) {
- $field = array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The vocabulary machine name.',
- );
-
- db_add_field('taxonomy_vocabulary', 'machine_name', $field);
+ $field = array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => '',
+ 'description' => 'The vocabulary machine name.',
+ );
- foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
- $machine_name = 'vocabulary_' . $vid;
- db_update('taxonomy_vocabulary')
- ->fields(array('machine_name' => 'vocabulary_' . $vid))
- ->condition('vid', $vid)
- ->execute();
- field_attach_create_bundle('taxonomy_term', $machine_name);
- }
+ db_add_field('taxonomy_vocabulary', 'machine_name', $field);
- variable_set('taxonomy_update_7002_done', TRUE);
+ foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
+ $machine_name = 'vocabulary_' . $vid;
+ db_update('taxonomy_vocabulary')
+ ->fields(array('machine_name' => 'vocabulary_' . $vid))
+ ->condition('vid', $vid)
+ ->execute();
+ field_attach_create_bundle('taxonomy_term', $machine_name);
}
}