You are here

function update_fix_watchdog_115 in Drupal 5

Same name and namespace in other branches
  1. 4 update.php \update_fix_watchdog_115()

System update 115 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.

This code, including the 'update_watchdog_115_fixed' variable, may be removed when update 115 is removed. It is part of the Drupal 4.5 to 4.7 migration.

1 call to update_fix_watchdog_115()
update.php in ./update.php
Administrative page for handling updates from one Drupal version to another.

File

./update.php, line 237
Administrative page for handling updates from one Drupal version to another.

Code

function update_fix_watchdog_115() {
  if (drupal_get_installed_schema_version('system') < 115 && !variable_get('update_watchdog_115_fixed', FALSE)) {
    if ($GLOBALS['db_type'] == 'mysql') {
      $ret[] = update_sql("ALTER TABLE {watchdog} ADD severity tinyint(3) unsigned NOT NULL default '0'");
    }
    else {
      if ($GLOBALS['db_type'] == 'pgsql') {
        $ret[] = update_sql('ALTER TABLE {watchdog} ADD severity smallint');
        $ret[] = update_sql('UPDATE {watchdog} SET severity = 0');
        $ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET NOT NULL');
        $ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET DEFAULT 0');
      }
    }
    variable_set('update_watchdog_115_fixed', TRUE);
  }
}