diff options
Diffstat (limited to 'modules/taxonomy/taxonomy.install')
-rw-r--r-- | modules/taxonomy/taxonomy.install | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install index 72fb016d3..e43bb0e91 100644 --- a/modules/taxonomy/taxonomy.install +++ b/modules/taxonomy/taxonomy.install @@ -226,6 +226,13 @@ function taxonomy_schema() { 'default' => '', 'description' => 'Name of the vocabulary.', ), + 'machine_name' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The vocabulary machine name.', + ), 'description' => array( 'type' => 'text', 'not null' => FALSE, @@ -345,3 +352,29 @@ function taxonomy_update_7001() { return $ret; } + +/** + * Add vocabulary machine_name column. + */ +function taxonomy_update_7002() { + $ret = array(); + $field = array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The vocabulary machine name.', + ); + + db_add_field($ret, 'taxonomy_vocabulary', 'machine_name', $field); + + 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($machine_name); + } + return $ret; +} |