/[drupal]/contributions/modules/uc_restrict_qty/uc_restrict_qty.install
ViewVC logotype

Diff of /contributions/modules/uc_restrict_qty/uc_restrict_qty.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Mon Apr 13 11:13:42 2009 UTC revision 1.1.2.1, Mon Apr 13 11:13:42 2009 UTC
# Line 0  Line 1 
1    <?php
2    // $Id$
3    
4    /**
5     * @file
6     * uc_restrict_qty module install file.
7     */
8    
9    /**
10     * Define the table structures.
11     *
12     * @return
13     *   The schema which contains the structure for the uc_restrict_qty module's tables.
14     */
15    function uc_restrict_qty_schema() {
16      $schema['uc_restrict_qty_products'] = array(
17        'fields' => array(
18          'rqpid' => array(
19            'type' => 'serial',
20            'unsigned' => TRUE,
21            'not null' => TRUE,
22          ),
23          'pfid' => array(
24            'description' => t('The ID of the product feature this is attached to.'),
25            'type' => 'int',
26            'unsigned' => TRUE,
27            'not null' => TRUE,
28            'default' => 0,
29          ),
30          'nid' => array(
31            'description' => t('The ID of the node this role feature is attached to.'),
32            'type' => 'int',
33            'unsigned' => TRUE,
34            'not null' => TRUE,
35            'default' => 0,
36          ),
37          'model' => array(
38            'description' => t('The product model.'),
39            'type' => 'varchar',
40            'length' => 255,
41            'default' => NULL,
42          ),
43          'qty' => array(
44            'description' => t('The quantity restriction.'),
45            'type' => 'int',
46            'unsigned' => TRUE,
47            'not null' => TRUE,
48            'default' => 0,
49          ),
50        ),
51        'indexes' => array(
52          'nid' => array('nid'),
53          'model' => array('model')
54        ),
55        'primary key' => array('rqpid'),
56      );
57      return $schema;
58    }
59    
60    
61    /**
62     * Implementation of hook_install().
63     *
64     * Inserts the uc_restrict_qty module's schema in the SQL database.
65     */
66    function uc_restrict_qty_install() {
67      drupal_install_schema('uc_restrict_qty');
68    }
69    
70    /**
71     * Implementation of hook_uninstall().
72     *
73     * Remove the variables and schema corresponding to the uc_restrict_qty module.
74     */
75    function uc_restrict_qty_uninstall() {
76      drupal_uninstall_schema('uc_restrict_qty');
77    
78      db_query("DELETE FROM {variable} WHERE name LIKE 'uc_restrict_qty_%%'");
79    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2