Code coverage for /20081101/modules/upload/upload.install

Line #Times calledCode
1
<?php
2
// $Id: upload.install,v 1.7 2008/02/10 19:09:58 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
71
function upload_install() {
8
  // Create table. The upload table might have been created in the Drupal 5
9
  // to Drupal 6 upgrade, and was migrated from the file_revisions table.
So
10
  // in this case, there is no need to create the table, it is already
there.
111
  if (!db_table_exists('upload')) {
121
    drupal_install_schema('upload');
131
  }
141
}
15
16
/**
17
 * Implementation of hook_uninstall().
18
 */
191
function upload_uninstall() {
20
  // Remove tables.
210
  drupal_uninstall_schema('upload');
220
}
23
24
/**
25
 * Implementation of hook_schema().
26
 */
271
function upload_schema() {
281
  $schema['upload'] = array(
291
    'description' => t('Stores uploaded file information and table
associations.'),
30
    'fields' => array(
31
      'fid' => array(
321
        'type' => 'int',
331
        'unsigned' => TRUE,
341
        'not null' => TRUE,
351
        'default' => 0,
361
        'description' => t('Primary Key: The {files}.fid.'),
371
      ),
38
      'nid' => array(
391
        'type' => 'int',
401
        'unsigned' => TRUE,
411
        'not null' => TRUE,
421
        'default' => 0,
431
        'description' => t('The {node}.nid associated with the uploaded
file.'),
441
      ),
45
      'vid' => array(
461
        'type' => 'int',
471
        'unsigned' => TRUE,
481
        'not null' => TRUE,
491
        'default' => 0,
501
        'description' => t('Primary Key: The {node}.vid associated with the
uploaded file.'),
511
      ),
52
      'description' => array(
531
        'type' => 'varchar',
541
        'length' => 255,
551
        'not null' => TRUE,
561
        'default' => '',
571
        'description' => t('Description of the uploaded file.'),
581
      ),
59
      'list' => array(
601
        'type' => 'int',
611
        'unsigned' => TRUE,
621
        'not null' => TRUE,
631
        'default' => 0,
641
        'size' => 'tiny',
651
        'description' => t('Whether the file should be visibly listed on
the node: yes(1) or no(0).'),
661
      ),
67
      'weight' => array(
681
        'type' => 'int',
691
        'not null' => TRUE,
701
        'default' => 0,
711
        'size' => 'tiny',
721
        'description' => t('Weight of this upload in relation to other
uploads in this node.'),
731
      ),
741
    ),
751
    'primary key' => array('vid', 'fid'),
76
    'indexes' => array(
771
      'fid' => array('fid'),
781
      'nid' => array('nid'),
791
    ),
80
  );
81
821
  return $schema;
830
}
84
85
861