You are here

function yr_verdata_schema in Yr Weatherdata 7

Same name and namespace in other branches
  1. 6.2 yr_verdata.install \yr_verdata_schema()
  2. 6 yr_verdata.install \yr_verdata_schema()
  3. 7.3 yr_verdata.install \yr_verdata_schema()

Implementation of hook_schema().

File

./yr_verdata.install, line 48
Install, update and uninstall functions for the yr_verdata module.

Code

function yr_verdata_schema() {
  $schema['yr_verdata'] = array(
    'description' => 'Table for stored locations.',
    'fields' => array(
      'yid' => array(
        'description' => 'The unique local identifier for a location.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'url' => array(
        'description' => 'The url for the forecast at yr.no.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'file' => array(
        'description' => 'The filename for the cahced forecast. An md5 hash of the url.',
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
      'lang' => array(
        'description' => 'The language we want the forecast in.',
        'type' => 'varchar',
        'length' => 8,
        'not null' => TRUE,
        'default' => '',
      ),
      'name' => array(
        'description' => 'The name of the location, for sorting purposes.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
      'region' => array(
        'description' => 'The name of the region, for sorting purposes.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
      'country' => array(
        'description' => 'The name of the country, for sorting purposes.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'description' => 'Used to sort locations in lists and blocks.',
        'type' => 'int',
        'length' => 1,
        'not null' => TRUE,
        'default' => 0,
      ),
      'updated' => array(
        'description' => 'The unix timestamp for the last time this location had its feed checked.',
        'type' => 'int',
        'length' => 12,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'region' => array(
        'region',
      ),
      'country' => array(
        'country',
      ),
    ),
    'primary key' => array(
      'yid',
    ),
  );
  return $schema;
}