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

Contents of /contributions/modules/todolist/todolist.install

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


Revision 1.4 - (show annotations) (download) (as text)
Wed Jul 30 04:34:25 2008 UTC (16 months ago) by marvil07
Branch: MAIN
Branch point for: DRUPAL-6--1
Changes since 1.3: +26 -2 lines
File MIME type: text/x-php
by diegoe & marvil07: pgsql compatibility

Add case pgsql for install and replace order by sort because order is a
reserved word on pgsql on module
1 <?php
2 // $Id: todolist.install,v 1.3 2008/07/29 22:11:22 marvil07 Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function todolist_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 db_query("
12 CREATE TABLE {todolist_task} (
13 `tid` int(10) unsigned NOT NULL auto_increment,
14 `nid` int(10) unsigned NOT NULL,
15 `sort` int(10) NOT NULL,
16 `status` int(11) NOT NULL,
17 `task` varchar(255) NOT NULL,
18 PRIMARY KEY (`tid`)
19 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
20 break;
21 case 'pgsql':
22 db_query("
23 CREATE TABLE {todolist_task} (
24 tid SERIAL,
25 nid smallint NOT NULL,
26 sort smallint NOT NULL,
27 status smallint NOT NULL,
28 task varchar(255) NOT NULL,
29 PRIMARY KEY (tid));
30 ");
31 break;
32 }
33 }
34
35 /**
36 * Implementation of hook_install().
37 */
38 function todolist_uninstall() {
39 if (db_table_exists('todolist_task')) {
40 db_query("DROP TABLE {todolist_task}");
41 }
42 }
43
44 // change a field name because it's a reserverd word in pgsql
45 function todolist_update_1() {
46 switch ($GLOBALS['db_type']) {
47 case 'mysql':
48 case 'mysqli':
49 $ret[] = update_sql("ALTER TABLE {todolist_task} CHANGE `order` `sort` INT(10) NOT NULL");
50 break;
51 }
52
53 return $ret;
54 }
55

  ViewVC Help
Powered by ViewVC 1.1.2