You are here

function finder_schema in Finder 7.2

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

Implements hook_schema().

File

./finder.install, line 11
Finder module install file.

Code

function finder_schema() {
  $schema['finder'] = array(
    'description' => t('Table storing finder definitions.'),
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'id',
      'identifier' => 'finder',
      // Exports will be as $finder
      'bulk export' => TRUE,
      'default hook' => 'finder_default_finders',
      // Function hook name.
      'admin_title' => 'title',
      'admin_description' => 'description',
      'api' => array(
        'owner' => 'finder',
        'api' => 'finder_default',
        // Base name for api include files.
        'minimum_version' => 2,
        'current_version' => 2,
      ),
      'object' => 'finder',
      // the variable that holds enabled/disabled status
      'status' => 'status',
      // CRUD callbacks
      'load callback' => 'finder_load',
      'load multiple callback' => 'finder_load_multiple',
      'load all callback' => 'finder_load_all',
      'create callback' => 'finder_new',
      'save callback' => 'finder_save',
      'delete callback' => 'finder_delete',
      'export callback' => 'finder_export',
      'import callback' => 'finder_import',
      'cache defaults' => TRUE,
      'default cache bin' => 'cache_finder',
    ),
    'fields' => array(
      'id' => array(
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'name' => array(
        'description' => 'Unique name for this object. Used to identify it programmatically.',
        'type' => 'varchar',
        'length' => 32,
      ),
      'views_view' => array(
        'description' => 'The unique name of the view.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'views_display' => array(
        'description' => 'An identifier for the display; usually generated from the views display_plugin, so should be something like page or page_1 or block_2, etc.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The human-readable title of this finder.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'The description of this finder.',
        'type' => 'text',
        'size' => 'big',
      ),
      'path' => array(
        'description' => 'Path for the finder page.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'block' => array(
        'description' => 'Provide block for this finder.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
      ),
      'status' => array(
        'description' => 'Whether the finder is enabled or disabled.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
      ),
      'settings' => array(
        'description' => 'Settings for this finder.',
        'type' => 'text',
        'size' => 'big',
        'serialize' => TRUE,
      ),
      'elements' => array(
        'description' => 'Elements for this finder.',
        'type' => 'text',
        'size' => 'big',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['finder_choice'] = array(
    'description' => t('Table storing precalculated finder choices.'),
    'fields' => array(
      'id' => array(
        'description' => 'Primary ID for the choice. Not really used for anything.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'finder' => array(
        'description' => 'The finder ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'element' => array(
        'description' => 'The finder element name.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'choice_key' => array(
        'description' => 'The key of the finder choice.',
        'type' => 'varchar',
        'length' => 1024,
      ),
      'choice_value' => array(
        'description' => 'The value of the finder choice.',
        'type' => 'varchar',
        'length' => 1024,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'finder_choice_finder' => array(
        'finder',
      ),
      'finder_choice_element' => array(
        'element',
      ),
      'finder_choice_key' => array(
        array(
          'choice_key',
          255,
        ),
      ),
      'finder_choice_value' => array(
        array(
          'choice_value',
          255,
        ),
      ),
    ),
    'foreign keys' => array(
      'finder_id' => array(
        'table' => 'finder',
        'columns' => array(
          'finder' => 'id',
        ),
      ),
    ),
  );
  $schema['cache_finder_find'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_finder'] = drupal_get_schema_unprocessed('system', 'cache');
  return $schema;
}