You are here

function uc_addresses_update_6000 in Ubercart Addresses 6

First Drupal 6 update: standardize database definitions as per uc_orders

File

./uc_addresses.install, line 179
Installation file of Ubercart Addresses

Code

function uc_addresses_update_6000() {
  db_drop_primary_key($ret, 'uc_addresses');
  db_drop_index($ret, 'uc_addresses', 'aid_uid_idx');
  db_change_field($ret, 'uc_addresses', 'aid', 'aid', array(
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ), array(
    'primary key' => array(
      'aid',
    ),
  ));
  db_change_field($ret, 'uc_addresses', 'uid', 'uid', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_change_field($ret, 'uc_addresses', 'first_name', 'delivery_first_name', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'last_name', 'delivery_last_name', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'phone', 'delivery_phone', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'company', 'delivery_company', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'street1', 'delivery_street1', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'street2', 'delivery_street2', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'city', 'delivery_city', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'zone', 'delivery_zone', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'size' => 'medium',
    'not null' => TRUE,
    'default' => 0,
  ));
  db_change_field($ret, 'uc_addresses', 'postal_code', 'delivery_postal_code', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'uc_addresses', 'country', 'delivery_country', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'size' => 'medium',
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_index($ret, 'uc_addresses', 'aid_uid_idx', array(
    'aid',
    'uid',
  ));
  db_drop_primary_key($ret, 'uc_addresses_defaults');
  db_change_field($ret, 'uc_addresses_defaults', 'aid', 'aid', array(
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ));
  db_change_field($ret, 'uc_addresses_defaults', 'uid', 'uid', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_primary_key($ret, 'uc_addresses_defaults', array(
    'aid',
    'uid',
  ));
  return $ret;
}