You are here

function imagepicker_update_2 in Image Picker 5.2

Same name and namespace in other branches
  1. 5 imagepicker.install \imagepicker_update_2()

File

./imagepicker.install, line 95
imagepicker install, update and uninstall functions

Code

function imagepicker_update_2() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $created1 = db_query("\n        CREATE TABLE IF NOT EXISTS {imagepicker_user_groups} (\n          `gid` int(10) unsigned NOT NULL AUTO_INCREMENT,\n          `uid` int(10) unsigned  NOT NULL default '0',\n          `group_name` varchar(255) NOT NULL default '',\n          `group_description` varchar(255) default NULL,\n          `state` tinyint(4) unsigned NOT NULL default '0',\n          PRIMARY KEY  (`gid`),\n          KEY `uid` (`uid`)\n          )\n      ");
      $created2 = db_query("\n        CREATE TABLE IF NOT EXISTS {imagepicker_group_images} (\n        `gid` int(10) unsigned NOT NULL default '0',\n        `img_id` int(10) unsigned NOT NULL default '0')\n      ");
      break;
  }
  if (!$created1 || !$created2) {
    drupal_set_message(t('Table installation for the Imagepicker module was unsuccessful.'), 'error');
  }
  else {
    drupal_set_message(t('Table installation for the Imagepicker module was successful.'), '');
  }
}