function location_phone_update_5300 in Location 7.4
Same name and namespace in other branches
- 5.3 contrib/location_phone/location_phone.install \location_phone_update_5300()
- 6.3 contrib/location_phone/location_phone.install \location_phone_update_5300()
- 7.5 contrib/location_phone/location_phone.install \location_phone_update_5300()
- 7.3 contrib/location_phone/location_phone.install \location_phone_update_5300()
Location 3.0 update 1. Fix pgsql -- The table definition was broken.
File
- contrib/
location_phone/ location_phone.install, line 51 - Installation routines.
Code
function location_phone_update_5300() {
$ret = array();
// Drupal 6 note: These should only affect postgresql, but are safe
// to run on mysql as well, so I don't bother checking db types.
if (!db_table_exists('location_phone')) {
db_create_table($ret, 'location_phone', array(
'fields' => array(
'lid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'phone' => array(
'type' => 'varchar',
'length' => 31,
'default' => NULL,
),
),
'primary key' => array(
'lid',
),
));
}
else {
// If the table WAS created (i.e. user manually fixed bug and reinstalled), g/c the postal_code column.
if (db_column_exists('location_phone', 'postal_code')) {
db_drop_field($ret, 'location_phone', 'postal_code');
}
}
return $ret;
}