function quotes_update_6 in Quotes 5
Implementation of hook_update_N(). Add count column to quotes_block table
File
- ./
quotes.install, line 234 - Handles installation and updates for the quotes module.
Code
function quotes_update_6() {
global $db_type;
$items = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$items[] = update_sql("ALTER TABLE {quotes_blocks} ADD COLUMN count INTEGER NOT NULL DEFAULT 1");
$items[] = update_sql("ALTER TABLE {quotes_blocks} ADD COLUMN show_titles INTEGER NOT NULL DEFAULT 0");
break;
case 'pgsql':
$items[] = update_sql("ALTER TABLE {quotes_blocks} ADD COLUMN count INTEGER");
$items[] = update_sql("UPDATE {quotes_blocks} SET count=0 WHERE count IS NULL");
$items[] = update_sql("ALTER TABLE {quotes_blocks} ALTER COLUMN count SET NOT NULL");
$items[] = update_sql("ALTER TABLE {quotes_blocks} ALTER COLUMN count SET DEFAULT 1");
$items[] = update_sql("ALTER TABLE {quotes_blocks} ADD COLUMN show_titles INTEGER");
$items[] = update_sql("UPDATE {quotes_blocks} SET show_titles=0 WHERE show_titles IS NULL");
$items[] = update_sql("ALTER TABLE {quotes_blocks} ALTER COLUMN show_titles SET NOT NULL");
$items[] = update_sql("ALTER TABLE {quotes_blocks} ALTER COLUMN show_titles SET DEFAULT 1");
break;
}
return $items;
}