You are here

function comment_upload_schema in Comment Upload 6

Implementation of hook_schema().

File

./comment_upload.install, line 31
The install file that defines the tables in use by comment_upload.

Code

function comment_upload_schema() {
  $schema['comment_upload'] = array(
    'description' => t('Stores uploaded file information and table associations.'),
    'fields' => array(
      'fid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {files}.fid.'),
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {node}.nid of the comment the uploaded files is associated with.'),
      ),
      'cid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {comment}.cid associated with the uploaded file.'),
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Description of the uploaded file.'),
      ),
      'list' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => t('Whether the file should be visibly listed on the comment: yes(1) or no(0).'),
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => t('Weight of this upload in relation to other uploads - determines the order.'),
      ),
      'legacy_fid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The file ID from the Drupal 5 version, if applicable.'),
      ),
    ),
    'primary key' => array(
      'fid',
    ),
    'indexes' => array(
      'cid_fid' => array(
        'cid',
        'fid',
      ),
      'nid' => array(
        'nid',
      ),
    ),
  );
  return $schema;
}