function node_update_7000

7.x node.install node_update_7000()

Upgrade the node type table and fix node type 'module' attribute to avoid name-space conflicts.

Related topics

File

drupal-7.x/modules/node/node.install, line 511
Install, update and uninstall functions for the node module.

Code

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')
    ->expression('module', 'base')
    ->condition('base', $modules, 'IN')
    ->execute();

  db_update('node_type')
    ->fields(array('base' => 'node_content'))
    ->condition('base', 'node')
    ->execute();
}