You are here

function openlayers_schema in Openlayers 6.2

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

Implementation of hook_schema().

File

./openlayers.install, line 37
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_map_presets'] = array(
    'description' => 'Storage for User defined OpenLayers map presets.',
    'export' => array(
      'key' => 'name',
      'identifier' => 'openlayers_presets',
      'default hook' => 'openlayers_presets',
      'api' => array(
        'owner' => 'openlayers',
        'api' => 'openlayers_presets',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'description' => t('The primary identifier for the preset.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => t('The title of the preset.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'description' => array(
        'description' => t('The description of the preset.'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => t('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',
      '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',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
    ),
  );

  // Styles table (ctools extras)
  $schema['openlayers_styles'] = array(
    'description' => 'Storage for user defined OpenLayers styles.',
    'export' => array(
      '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',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}