You are here

function sarnia_schema in Sarnia 7

Implements hook_schema().

File

./sarnia.install, line 6

Code

function sarnia_schema() {
  $schema['sarnia_entity_type'] = array(
    'description' => 'Store information about defined Sarnia bundles.',
    'fields' => array(
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
      'search_api_server' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
      'search_api_index' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
      'id_field' => array(
        'type' => 'varchar',
        'length' => 255,
        // @TODO Solr has arbitrary length fields. Is 255 characters sufficient?
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'machine_name',
    ),
    // cTools Export API elements.
    'export' => array(
      'key' => 'machine_name',
      'primary key' => 'machine_name',
      'identifier' => 'sarnia_index',
      'default hook' => 'default_sarnia_preset',
      'api' => array(
        'owner' => 'sarnia',
        'api' => 'sarnia',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
  );
  $schema['sarnia_solr_service_schema'] = array(
    'description' => 'Map behaviors of Solr fields',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'search_api_server' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'behavior' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'match_type' => array(
        'description' => '"name", "dynamicbase", or "type"',
        'type' => 'varchar',
        'length' => 255,
      ),
      'match_value' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'effect' => array(
        'description' => '"disable" or "replace"',
        'type' => 'varchar',
        'length' => 255,
      ),
      'replacement' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'enabled' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}