You are here

function search_by_page_schema in Search by Page 6

Same name and namespace in other branches
  1. 8 search_by_page.install \search_by_page_schema()
  2. 7 search_by_page.install \search_by_page_schema()

Implementation of hook_schema().

File

./search_by_page.install, line 11
Install hooks for search_by_page module

Code

function search_by_page_schema() {
  $schema['sbp_path'] = array(
    'description' => t('Contains path definitions for Search by Page module'),
    'fields' => array(
      'pid' => array(
        'description' => t('Primary key'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'last_index_time' => array(
        'description' => t('When this path was last indexed by search'),
        'type' => 'int',
        'size' => 'big',
        'default' => 0,
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      // Do not use 'path' as a db field - reserved word!
      'page_path' => array(
        'description' => t('Path to index'),
        'type' => 'varchar',
        'length' => 255,
      ),
      // Do not use 'module' as a db field - reserved word!
      'from_module' => array(
        'description' => t('Module this path came from'),
        'type' => 'varchar',
        'length' => 255,
      ),
      // Do not use 'mid' as a db field - mid() is a function!
      'modid' => array(
        'description' => t('Identifier from module'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'language' => array(
        'description' => t('Language for this path'),
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
        'default' => '',
      ),
      'environment' => array(
        'description' => t('Environment ID'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'role' => array(
        'description' => t('Role ID used to index this path'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'min_time' => array(
        'description' => t('Minimum reindex time'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'max_time' => array(
        'description' => t('Maximum reindex time'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'indexes' => array(
      'upd_time' => array(
        'last_index_time',
      ),
      'modl' => array(
        'from_module',
      ),
      'pth' => array(
        'page_path',
      ),
      'm_id' => array(
        'modid',
      ),
      'envi' => array(
        'environment',
      ),
      'role' => array(
        'role',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
  );
  $schema['sbp_index_users'] = array(
    'description' => t('Users to be used for search indexing'),
    'fields' => array(
      'rid' => array(
        'description' => t('Role ID'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => t('User ID of user created for this role'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  return $schema;
}