function weather_update_3 in Weather 5.6
Same name and namespace in other branches
- 5 weather.install \weather_update_3()
File
- ./
weather.install, line 255
Code
function weather_update_3() {
$ret = array();
// add the configuration id to weather_config,
// to enable multiple locations in one block.
// unfortunately, postgresql does not seem to support
// this well enough, so we just drop the table created
// in update_2 and re-create it again.
$sql = "DROP TABLE {weather_config}";
$ret[] = update_sql($sql);
// the table stores the configuration of a custom user weather block
// uid: user id
// cid: configuration id, to enable multiple locations in one block
// icao: ICAO code of the METAR station
// real_name: the name to display for the ICAO code
// units: units for display (metric, imperial)
// weight: the weight of the location
$sql = "CREATE TABLE {weather_config} (\n uid INTEGER DEFAULT 0 NOT NULL,\n cid INTEGER DEFAULT 0 NOT NULL,\n icao VARCHAR(4) DEFAULT '' NOT NULL,\n real_name VARCHAR(255) DEFAULT '' NOT NULL,\n units VARCHAR(8) DEFAULT 'metric' NOT NULL,\n weight INTEGER DEFAULT 0 NOT NULL,\n PRIMARY KEY (uid, cid)\n )";
// ensure the utf8 character set on MySQL (syntax for 4.1 and above)
if ($GLOBALS['db_type'] == 'mysql' or $GLOBALS['db_type'] == 'mysqli') {
$sql .= " /*!40100 DEFAULT CHARACTER SET utf8 */";
}
$ret[] = update_sql($sql);
return $ret;
}