You are here

function apachesolr_attachments_schema in Apache Solr Attachments 7

Same name and namespace in other branches
  1. 6.3 apachesolr_attachments.install \apachesolr_attachments_schema()
  2. 6 apachesolr_attachments.install \apachesolr_attachments_schema()
  3. 6.2 apachesolr_attachments.install \apachesolr_attachments_schema()

Implements hook_schema().

2 calls to apachesolr_attachments_schema()
apachesolr_attachments_update_7004 in ./apachesolr_attachments.install
Change apachesolr_index_entities_file.body field to longblob.
apachesolr_attachments_update_7005 in ./apachesolr_attachments.install
Add cache bin, and remove the 'body' field from the indexer table.

File

./apachesolr_attachments.install, line 57
Install, update and uninstall functions for the apachesolr_attachments module.

Code

function apachesolr_attachments_schema() {
  $types = array(
    'file' => 'apachesolr_index_entities_file',
  );
  foreach ($types as $type => $table) {
    $schema[$table] = array(
      'description' => t('Stores a record of when an entity changed to determine if it needs indexing by Solr.'),
      'fields' => array(
        'entity_type' => array(
          'description' => t('The type of entity.'),
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
        ),
        'entity_id' => array(
          'description' => t('The primary identifier for an entity.'),
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
        'bundle' => array(
          'description' => t('The bundle to which this entity belongs.'),
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
        ),
        'status' => array(
          'description' => t('Boolean indicating whether the entity is visible to non-administrators (eg, published for nodes).'),
          'type' => 'int',
          'not null' => TRUE,
          'default' => 1,
        ),
        'changed' => array(
          'description' => t('The Unix timestamp when an entity was changed.'),
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'parent_entity_type' => array(
          'description' => t('The type of entity.'),
          'type' => 'varchar',
          'length' => 128,
          'not null' => FALSE,
        ),
        'parent_entity_id' => array(
          'description' => t('The type of the parent entity.'),
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => FALSE,
        ),
        'hash' => array(
          'description' => "A hash of the file's body, to check for changes.",
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'indexes' => array(
        'changed' => array(
          'changed',
          'status',
        ),
      ),
      'primary key' => array(
        'entity_id',
        'parent_entity_id',
        'parent_entity_type',
      ),
    );
  }
  $schema['cache_apachesolr_attachments_file_body'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_apachesolr_attachments_file_body']['description'] = 'Cache table for the Apache Solr Attachments module.';
  return $schema;
}