diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-10-07 00:28:20 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-10-07 00:28:20 +0000 |
commit | 65b99dc85fde083cca0938634bb15c4e1779c50d (patch) | |
tree | e6313de07afaf6962b0cfe4f0c637a3845e6d06b /modules/node/node.install | |
parent | 466c8ff543ec24e224d1c03a856d6e89459e4243 (diff) | |
download | brdo-65b99dc85fde083cca0938634bb15c4e1779c50d.tar.gz brdo-65b99dc85fde083cca0938634bb15c4e1779c50d.tar.bz2 |
#895014 by Damien Tournoud, chx, catch: Fixed all fields of a node type are lost on module disable.
Diffstat (limited to 'modules/node/node.install')
-rw-r--r-- | modules/node/node.install | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/modules/node/node.install b/modules/node/node.install index 5f93db2e8..e50571ab2 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -294,6 +294,12 @@ function node_schema() { 'length' => 255, 'not null' => TRUE, ), + 'module' => array( + 'description' => 'The module defining this node type.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + ), 'description' => array( 'description' => 'A brief description of this type.', 'type' => 'text', @@ -344,6 +350,13 @@ function node_schema() { 'default' => 0, 'size' => 'tiny', ), + 'disabled' => array( + 'description' => 'A boolean indicating whether the node type is disabled.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny' + ), 'orig_type' => array( 'description' => 'The original machine-readable name of this node type. This may be different from the current type name if the locked field is 0.', 'type' => 'varchar', @@ -438,16 +451,40 @@ function _update_7000_node_get_types() { */ /** - * Fix node type 'module' attribute to avoid name-space conflicts. + * Upgrade the node type table and fix node type 'module' attribute to avoid name-space conflicts. */ function node_update_7000() { + // Rename the module column to base. + db_change_field('node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); + + db_add_field('node_type', 'module', array( + 'description' => 'The module defining this node type.', + 'type' => 'varchar', + 'default' => '', + 'length' => 255, + 'not null' => TRUE, + )); + + db_add_field('node_type', 'disabled', array( + 'description' => 'A boolean indicating whether the node type is disabled.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny' + )); + + $modules = db_select('system', 's') + ->fields('s', array('name')) + ->condition('type', 'module'); db_update('node_type') - ->fields(array('module' => 'node_content')) - ->condition('module', 'node') + ->expression('module', 'base') + ->condition('base', $modules, 'IN') ->execute(); - // Rename the module column to base. - db_change_field('node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); + db_update('node_type') + ->fields(array('base' => 'node_content')) + ->condition('base', 'node') + ->execute(); } /** |