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

Contents of /contributions/modules/invvoucher/invvoucher.install

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


Revision 1.3 - (show annotations) (download) (as text)
Thu Jun 4 00:11:34 2009 UTC (5 months, 3 weeks ago) by dearanton
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
File MIME type: text/x-php
#343936 Yo-message when installing module is terminated
1 <?php
2 //$Id: invvoucher.install,v 1.2 2008/09/17 21:39:00 dearanton Exp $
3 // invitation voucher drupal module install
4
5 function invvoucher_install() {
6 switch ($GLOBALS['db_type']) {
7 case 'mysql':
8 case 'mysqli':
9 $result1 = db_query("
10 CREATE TABLE `invvoucher` (
11 `code` VARCHAR( 10 ) NOT NULL ,
12 `reg_count` INT DEFAULT '0' NOT NULL ,
13 `date_sent` INT DEFAULT '0' NOT NULL ,
14 `date_exp` INT DEFAULT '0' NOT NULL ,
15 `email` VARCHAR( 30 ) NOT NULL,
16 PRIMARY KEY ( `code` ) ,
17 INDEX ( `date_sent` )
18 );"
19 );
20 $result2 = db_query("ALTER TABLE {invvoucher} ADD INDEX (date_exp)");
21 $result3 = db_query("
22 CREATE TABLE `invvoucher_users` (
23 `code` VARCHAR( 10 ) NOT NULL ,
24 `uid` VARCHAR( 10 ) NOT NULL ,
25 PRIMARY KEY ( `uid` ) ,
26 INDEX ( `code` )
27 );"
28 );
29 break;
30
31 case 'pgsql':
32 $result1 = db_query("
33 CREATE TABLE {invvoucher} (
34 code VARCHAR(10) NOT NULL,
35 reg_count INT NOT NULL DEFAULT '0',
36 date_sent INT NOT NULL DEFAULT '0',
37 date_exp INT NOT NULL DEFAULT '0',
38 email VARCHAR( 30 ) NOT NULL,
39 PRIMARY KEY (code),
40 INDEX ( date_sent , date_exp )
41 );"
42 );
43 $result2 = db_query("CREATE INDEX {invvoucher}_date_exp_idx ON {invvoucher} (date_exp)");
44 $result1 = db_query("
45 CREATE TABLE {invvoucher_users} (
46 code VARCHAR(10) NOT NULL,
47 uid VARCHAR(10) NOT NULL,
48 PRIMARY KEY (code),
49 INDEX ( uid , code )
50 );"
51 );
52
53 break;
54 }
55
56 if ($result1 && $result2 && $result3) {
57 drupal_set_message(t('The database schema for the Invitation Voucher module has been successfully updated.'));
58 }
59 else {
60 drupal_set_message(t('Problems occurred while updating the database schema for the Invitaion Voucher module.'));
61 }
62 }
63
64 function invvoucher_uninstall() {
65 db_query('DROP TABLE {invvoucher}');
66 db_query('DROP TABLE {invvoucher_users}');
67 drupal_set_message(t('Invitation Voucher module has been successfully uninstalled.'));
68 }

  ViewVC Help
Powered by ViewVC 1.1.2