function weather_schema in Weather 6.5
Same name and namespace in other branches
- 7.3 weather.install \weather_schema()
- 7 weather.install \weather_schema()
- 7.2 weather.install \weather_schema()
Implementation of hook_schema().
File
- ./
weather.install, line 67 - Database installation of weather module.
Code
function weather_schema() {
$schema['weather'] = array(
'description' => 'Stores the raw METAR data for each ICAO code, together with the time of the next scheduled update',
'fields' => array(
'icao' => array(
'description' => 'ICAO code of the METAR station',
'type' => 'varchar',
'length' => 4,
'not null' => TRUE,
'default' => '',
),
'next_update_on' => array(
'description' => 'UNIX timestamp of next possible update',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'metar_raw' => array(
'description' => 'Raw METAR data, not parsed',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'icao',
),
);
$schema['weather_config'] = array(
'description' => 'Stores the configuration of one weather display',
'fields' => array(
'uid' => array(
'description' => 'User ID for custom weather blocks, 0 is used for storing the default configuration, negative IDs are used for multiple system weather blocks.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'cid' => array(
'description' => 'Configuration ID, to enable multiple locations in one block',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'icao' => array(
'description' => 'ICAO code of the METAR station',
'type' => 'varchar',
'length' => 4,
'not null' => TRUE,
'default' => '',
),
'real_name' => array(
'description' => 'The name to display for the ICAO code',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'units' => array(
'description' => 'Units for display (Celsius/Fahrenheit, mmHg/hPa etc.)',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'settings' => array(
'description' => 'Settings for display (Show raw METAR, abbrev. wind directions etc.)',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'description' => 'Weight of the location',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'uid',
'cid',
),
);
$schema['weather_icao'] = array(
'description' => 'Contains all known ICAO codes with further information. The countries are not decoupled, but that is probably not worth the effort.',
'fields' => array(
'icao' => array(
'description' => 'ICAO code of the METAR station',
'type' => 'varchar',
'length' => 4,
'not null' => TRUE,
'default' => '',
),
'country' => array(
'description' => 'Name of the country',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'description' => 'Name of the METAR station',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'latitude' => array(
'description' => 'Location of METAR station, latitude',
'type' => 'float',
'size' => 'big',
'not null' => TRUE,
'default' => 0.0,
),
'longitude' => array(
'description' => 'Location of METAR station, longitude',
'type' => 'float',
'size' => 'big',
'not null' => TRUE,
'default' => 0.0,
),
),
'primary key' => array(
'icao',
),
);
return $schema;
}