You are here

function location_phone_update_5300 in Location 7.3

Same name and namespace in other branches
  1. 5.3 contrib/location_phone/location_phone.install \location_phone_update_5300()
  2. 6.3 contrib/location_phone/location_phone.install \location_phone_update_5300()
  3. 7.5 contrib/location_phone/location_phone.install \location_phone_update_5300()
  4. 7.4 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 57
Install, update and uninstall functions for the location_phone module.

Code

function location_phone_update_5300() {
  if (!db_table_exists('location_phone')) {
    $schema['location_phone'] = array(
      'description' => 'location_phone.module {location} supplementary table.',
      'fields' => array(
        'lid' => array(
          'description' => '{location}.lid',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
        'phone' => array(
          'description' => 'Phone number',
          'type' => 'varchar',
          'length' => 31,
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'primary key' => array(
        'lid',
      ),
    );
    db_create_table('location_phone', $schema['location_phone']);
  }
  else {

    // If the table WAS created (i.e. user manually fixed bug and reinstalled), g/c the postal_code column.
    if (db_field_exists('location_phone', 'postal_code')) {
      db_drop_field('location_phone', 'postal_code');
    }
  }
}