You are here

function shoutbox_update_5200 in Shoutbox 7.2

Same name and namespace in other branches
  1. 5 shoutbox.install \shoutbox_update_5200()
  2. 6.2 shoutbox.install \shoutbox_update_5200()
  3. 6 shoutbox.install \shoutbox_update_5200()
  4. 7 shoutbox.install \shoutbox_update_5200()

Update hook. This update prepares the database for shoutbox 5.2.x Removes the moderation table Drops the status column on the shoutbox table Adds sid column to the shoutbox table

File

./shoutbox.install, line 120
Install, update and uninstall functions for the Shoutbox module.

Code

function shoutbox_update_5200() {
  $success_table_drop = db_drop_table('shoutbox_moderation');
  $success_drop_status = db_drop_field('shoutbox', 'status');
  $sid_spec = array(
    'type' => 'varchar',
    'length' => 64,
    'not null' => TRUE,
    'default' => '',
    'description' => 'Session id of the current session.',
  );
  $success_add_sid = db_add_field('shoutbox', 'sid', $sid_spec);
  if (!$success_table_drop) {
    throw new DrupalUpdateException(t('Database table \'shoutbox_moderation\' was not found. '));
  }
  if (!$success_drop_status) {
    throw new DrupalUpdateException(t('Database \'shoutbox\' did not have a column called \'status\''));
  }
}