You are here

function uc_attribute_update_2 in Ubercart 5

File

uc_attribute/uc_attribute.install, line 193

Code

function uc_attribute_update_2() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {uc_attributes} ADD COLUMN ordering tinyint(2) NOT NULL default 0 AFTER name");
      $ret[] = update_sql("ALTER TABLE {uc_attribute_options} ADD COLUMN ordering tinyint(2) NOT NULL default 0 AFTER weight");
      $ret[] = update_sql("ALTER TABLE {uc_class_attributes} ADD COLUMN ordering tinyint(2) NOT NULL default 0 AFTER aid");
      $ret[] = update_sql("ALTER TABLE {uc_class_attribute_options} ADD COLUMN ordering tinyint(2) NOT NULL default 0 AFTER weight");
      $ret[] = update_sql("ALTER TABLE {uc_product_attributes} ADD COLUMN ordering tinyint(2) NOT NULL default 0 AFTER aid");
      $ret[] = update_sql("ALTER TABLE {uc_product_options} ADD COLUMN ordering tinyint(2) NOT NULL default 0 AFTER weight");
      break;
    case 'pgsql':
      db_add_column($ret, 'uc_attributes', 'ordering', 'smallint', array(
        'not null' => true,
        'default' => 0,
      ));
      db_add_column($ret, 'uc_attribute_options', 'ordering', 'smallint', array(
        'not null' => true,
        'default' => 0,
      ));
      db_add_column($ret, 'uc_class_attributes', 'ordering', 'smallint', array(
        'not null' => true,
        'default' => 0,
      ));
      db_add_column($ret, 'uc_class_attribute_options', 'ordering', 'smallint', array(
        'not null' => true,
        'default' => 0,
      ));
      db_add_column($ret, 'uc_product_attributes', 'ordering', 'smallint', array(
        'not null' => true,
        'default' => 0,
      ));
      db_add_column($ret, 'uc_product_options', 'ordering', 'smallint', array(
        'not null' => true,
        'default' => 0,
      ));
  }
  return $ret;
}