summaryrefslogtreecommitdiff
path: root/modules/blogapi/blogapi.install
blob: 2bbcd57a34632ddf398579a6cac787e1f43b8951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
// $Id$

/**
 * @file
 * Install, update and uninstall functions for the blogapi module.
 */

/**
 * Implement hook_install().
 */
function blogapi_install() {
  // Create tables.
  drupal_install_schema('blogapi');
}

/**
 * Implement hook_uninstall().
 */
function blogapi_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('blogapi');
}


/**
 * Implement hook_schema().
 */
function blogapi_schema() {
  $schema['blogapi_files'] = array(
    'description' => 'Stores information for files uploaded via the blogapi.',
    'fields' => array(
      'fid' => array(
        'description' => 'Primary Key: Unique file ID.',
        'type' => 'serial',
      ),
      'uid' => array(
        'description' => 'The {users}.uid of the user who is associated with the file.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'filepath' => array(
        'description' => 'Path of the file relative to Drupal root.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'filesize' => array(
        'description' => 'The size of the file in bytes.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('fid'),
    'indexes' => array(
      'uid' => array('uid'),
    ),
    'foreign keys' => array(
      'uid' => array('users' => 'uid'),
    ),
  );

  return $schema;
}