You are here

function comment_notify_update_5200 in Comment Notify 5.2

Drop the notify column from the {comments} table. This column will only exist if the 5.x-1.x version of comment_notify was installed at some point. Since the 5.x-2.x version of the module {comment_notify}.notify has been used instead.

File

./comment_notify.install, line 173
comment_notify.install.

Code

function comment_notify_update_5200() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      if (db_fetch_object(db_query("SHOW COLUMNS FROM {comments} LIKE 'notify'"))) {
        $ret[] = update_sql('ALTER TABLE {comments} DROP COLUMN notify');
      }
      break;
    case 'pgsql':
      if (db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{comments}' AND attname = 'notify'"))) {
        $ret[] = update_sql('ALTER TABLE {comments} DROP COLUMN notify');
      }
      break;
  }
  return $ret;
}