/[drupal]/contributions/modules/ubercart/uc_file/uc_file.install
ViewVC logotype

Contents of /contributions/modules/ubercart/uc_file/uc_file.install

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


Revision 1.2 - (show annotations) (download) (as text)
Thu Jul 10 12:41:01 2008 UTC (16 months, 2 weeks ago) by islandusurper
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--2
Changes since 1.1: +127 -46 lines
File MIME type: text/x-php
Begin the Ubercart 6.x-2.x branch.
1 <?php
2 // $Id$
3
4 function uc_file_schema() {
5 $schema = array();
6
7 $schema['uc_files'] = array(
8 'fields' => array(
9 'fid' => array(
10 'type' => 'serial',
11 'unsigned' => TRUE,
12 'not null' => TRUE,
13 ),
14 'filename' => array(
15 'type' => 'varchar',
16 'length' => 255,
17 'not null' => TRUE,
18 'default' => '',
19 ),
20 ),
21 'primary key' => array('fid'),
22 );
23
24 $schema['uc_file_products'] = array(
25 'fields' => array(
26 'pfid' => array(
27 'type' => 'serial',
28 'unsigned' => TRUE,
29 'not null' => TRUE,
30 ),
31 'fid' => array(
32 'type' => 'int',
33 'unsigned' => TRUE,
34 'not null' => TRUE,
35 'default' => 0,
36 ),
37 'model' => array(
38 'type' => 'varchar',
39 'length' => 255,
40 'not null' => FALSE,
41 ),
42 'description' => array(
43 'type' => 'varchar',
44 'length' => 255,
45 'not null' => FALSE,
46 ),
47 'shippable' => array(
48 'type' => 'int',
49 'size' => 'tiny',
50 'not null' => FALSE,
51 ),
52 ),
53 'indexes' => array(
54 'uc_file_products_pfid' => array('pfid'),
55 'uc_file_products_fid' => array('fid'),
56 ),
57 );
58
59 $schema['uc_file_users'] = array(
60 'fields' => array(
61 'fid' => array(
62 'type' => 'int',
63 'unsigned' => TRUE,
64 'not null' => TRUE,
65 'default' => 0,
66 ),
67 'uid' => array(
68 'type' => 'int',
69 'unsigned' => TRUE,
70 'not null' => TRUE,
71 'default' => 0,
72 ),
73 'pfid' => array(
74 'type' => 'int',
75 'unsigned' => TRUE,
76 'not null' => FALSE,
77 ),
78 'key' => array(
79 'type' => 'varchar',
80 'length' => 32,
81 'not null' => TRUE,
82 'default' => '',
83 ),
84 'granted' => array(
85 'type' => 'int',
86 'not null' => TRUE,
87 'default' => 0,
88 ),
89 'accessed' => array(
90 'type' => 'int',
91 'size' => 'small',
92 'unsigned' => TRUE,
93 'not null' => TRUE,
94 'default' => 0,
95 ),
96 'addresses' => array(
97 'type' => 'text',
98 ),
99 ),
100 'indexes' => array(
101 'uc_file_users_fid' => array('fid'),
102 'uc_file_users_uid' => array('uid'),
103 ),
104 );
105
106 return $schema;
107 }
108
109 function uc_file_install() {
110 drupal_install_schema('uc_file');
111 }
112
113 function uc_file_uninstall() {
114 drupal_uninstall_schema('uc_file');
115 db_query("DELETE FROM {uc_product_features} WHERE fid = 'file'");
116 }
117
118 function uc_file_update_1() {
119 $ret = array();
120
121 switch ($GLOBALS['db_type']) {
122 case 'mysql':
123 case 'mysqli':
124 $ret[] = update_sql("ALTER TABLE {uc_file_products} ADD `description` VARCHAR( 255 ) NULL AFTER `model`");
125 $ret[] = update_sql("ALTER TABLE {uc_file_users} CHANGE model `pfid` mediumint(9) NULL DEFAULT NULL");
126 break;
127 case 'pgsql':
128 break;
129 }
130
131 return $ret;
132 }
133
134 function uc_file_update_2() {
135 $ret = array();
136 switch ($GLOBALS['db_type']) {
137 case 'pgsql':
138 db_change_column($ret, 'uc_file_users', 'accessed', 'accessed', 'smallint_unsigned', array('not null' => true, 'default' => 0));
139 break;
140 }
141 return $ret;
142 }

  ViewVC Help
Powered by ViewVC 1.1.2