You are here

function location_update_5302 in Location 7.4

Same name and namespace in other branches
  1. 5.3 location.install \location_update_5302()
  2. 6.3 location.install \location_update_5302()
  3. 7.5 location.install \location_update_5302()
  4. 7.3 location.install \location_update_5302()

Location 3.x update 3. Add genid to {location_instance}.

File

./location.install, line 737
Installation / uninstallation routines.

Code

function location_update_5302() {
  $ret = array();

  // OK, here's the deal. I retrofitted 5301 on Aug 18 2008 to integrate the genid.
  // This was needed to fix the pre location 3.x todo item regarding keeping non
  // user, non node data intact. People doing an update after Aug 18 will already
  // have the genid column in place, so it can be safely skipped.
  if (!variable_get('location_update_5301_retrofit', FALSE)) {
    switch ($GLOBALS['db_type']) {
      case 'mysql':
      case 'mysqli':
        $ret[] = update_sql("ALTER TABLE {location_instance} ADD COLUMN genid varchar(255) NOT NULL default '' AFTER uid");
        $ret[] = update_sql('CREATE INDEX {location_instance}_genid_idx ON {location_instance} (genid)');
        break;
      case 'pgsql':
        db_add_column($ret, 'location_instance', 'genid', 'varchar(255)', array(
          'not null' => TRUE,
          'default' => "''",
        ));
        $ret[] = update_sql('CREATE INDEX {location_instance}_genid_idx ON {location_instance} (genid)');
        break;
    }
  }
  return $ret;
}