You are here

privatemsg_attachments.install in Privatemsg 6.2

Installation hooks for privatemsg_attachments

File

privatemsg_attachments/privatemsg_attachments.install
View source
<?php

/**
 * @file
 * Installation hooks for privatemsg_attachments
 */

/**
 * Implements hook_install().
 */
function privatemsg_attachments_install() {
  drupal_install_schema('privatemsg_attachments');
}

/**
 * Implements hook_uninstall().
 */
function privatemsg_attachments_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('privatemsg_attachments');
  variable_del('privatemsg_attachments_upload_dir');
}

/**
 * Implements hook_schema().
 */
function privatemsg_attachments_schema() {
  $schema['pm_attachments'] = array(
    'description' => t('Stores uploaded file information and table associations for private messages.'),
    'fields' => array(
      'fid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Primary Key: The {files}.fid.'),
      ),
      'mid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {pm_message}.mid 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 node: 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 in this node.'),
      ),
    ),
    'primary key' => array(
      'mid',
      'fid',
    ),
    'indexes' => array(
      'fid' => array(
        'fid',
      ),
    ),
  );
  return $schema;
}