You are here

function openlayers_schema in Openlayers 7.2

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

Implements hook_schema().

File

./openlayers.install, line 28
This file holds the functions for the installing and enabling of the openlayers module.

Code

function openlayers_schema() {
  $schema = array();

  // Maps table (ctools extras)
  $schema['openlayers_maps'] = array(
    'description' => 'Storage for User defined OpenLayers maps.',
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'name',
      'identifier' => 'openlayers_maps',
      'default hook' => 'openlayers_maps',
      'api' => array(
        'owner' => 'openlayers',
        'api' => 'openlayers_maps',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'description' => 'The primary identifier for the map.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The title of the map.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'description' => array(
        'description' => 'The description of the map.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => 'The serialized map.',
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );

  // Layer table (ctools extras)
  $schema['openlayers_layers'] = array(
    'description' => 'Storage for user defined OpenLayers layers.',
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'name',
      'identifier' => 'openlayers_layers',
      'default hook' => 'openlayers_layers',
      'api' => array(
        'owner' => 'openlayers',
        'api' => 'openlayers_layers',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Layer name.',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Layer title.',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Layer description.',
      ),
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Layer data serialized.',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );

  // Projection table (ctools extras)
  // TODO: Translations missing?
  $schema['openlayers_projections'] = array(
    'description' => 'Storage for user defined OpenLayers projections.',
    'export' => array(
      'key' => 'identifier',
      'key name' => 'Identifier',
      'primary key' => 'identifier',
      'identifier' => 'openlayers_projections',
      'default hook' => 'openlayers_projections',
      'api' => array(
        'owner' => 'openlayers',
        'api' => 'openlayers_projections',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'identifier' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => 'Opaque identifier. Guaranteed to be unique but does not have any other meaning.',
      ),
      'authority' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Projection authority.',
      ),
      'code' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Projection code.',
      ),
      'definition' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Projection definition (proj4 format).',
      ),
      'projectedextentleft' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Leftmost value in this projection's coordinates",
        'precision' => 10,
        'scale' => 0,
      ),
      'projectedextentbottom' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Bottommost value in this projection's coordinates",
        'precision' => 10,
        'scale' => 0,
      ),
      'projectedextentright' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Rightmost value in this projection's coordinates",
        'precision' => 10,
        'scale' => 0,
      ),
      'projectedextenttop' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Topmost value in this projection's coordinates",
        'precision' => 10,
        'scale' => 0,
      ),
      // TODO Hopefully never used
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Projection data serialized.',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'identifier',
    ),
  );

  // Styles table (ctools extras)
  $schema['openlayers_styles'] = array(
    'description' => 'Storage for user defined OpenLayers styles.',
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'name',
      'identifier' => 'openlayers_styles',
      'default hook' => 'openlayers_styles',
      'api' => array(
        'owner' => 'openlayers',
        'api' => 'openlayers_styles',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Style name.',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Style title.',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Style description.',
      ),
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Style data serialized.',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  return $schema;
}