You are here

function search_by_page_schema in Search by Page 8

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

Implements hook_schema().

File

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

Code

function search_by_page_schema() {
  $schema['search_by_page_path'] = array(
    'description' => 'Contains path definitions for Search by Page module',
    'fields' => array(
      'pid' => array(
        'description' => 'Primary key',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'last_index_time' => array(
        'description' => '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' => 'Path to index',
        'type' => 'varchar',
        'length' => 255,
      ),
      // Do not use 'module' as a db field - reserved word!
      'from_module' => array(
        'description' => 'Module this path came from',
        'type' => 'varchar',
        'length' => 255,
      ),
      // Do not use 'mid' as a db field - mid() is a function!
      'modid' => array(
        'description' => 'Identifier from module',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'language' => array(
        'description' => 'Language for this path',
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
        'default' => '',
      ),
      'page_data' => array(
        'description' => 'Page contents as of last index',
        'type' => 'text',
        'size' => 'medium',
        'not null' => FALSE,
      ),
      'environment' => array(
        'description' => 'Environment ID',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'role' => array(
        'description' => '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['search_by_page_index_users'] = array(
    'description' => 'Users to be used for search indexing',
    'fields' => array(
      'rid' => array(
        'description' => 'Role ID',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => 'User ID of user created for this role',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  $schema['search_by_page_test_access'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'private' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}