You are here

function sbp_attach_schema in Search by Page 6

Same name and namespace in other branches
  1. 7 sbp_attach.install \sbp_attach_schema()

Implementation of hook_schema().

File

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

Code

function sbp_attach_schema() {
  $schema['sbpa_files'] = array(
    'description' => t('Contains files to be indexed by sbp_attach module'),
    'fields' => array(
      'fid' => array(
        'description' => t('Primary key'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'source' => array(
        'description' => t('Did this come from Upload, CCK, etc.'),
        'type' => 'varchar',
        'length' => 30,
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.nid associated with the uploaded file.',
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.vid associated with the uploaded file.',
      ),
      // Do not use 'type' as a db field - reserved word!
      'typename' => array(
        'description' => t('If CCK, name of content type'),
        'type' => 'varchar',
        'length' => 255,
      ),
      'fieldname' => array(
        'description' => t('If CCK, name of field'),
        'type' => 'varchar',
        'length' => 255,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
    'indexes' => array(
      'src' => array(
        'source',
      ),
      'nid' => array(
        'nid',
      ),
      'vid' => array(
        'vid',
      ),
    ),
  );
  return $schema;
}