/[drupal]/contributions/sandbox/alex_b/mtk/id_map/id_map.install
ViewVC logotype

Contents of /contributions/sandbox/alex_b/mtk/id_map/id_map.install

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


Revision 1.1 - (show annotations) (download) (as text)
Thu Aug 7 17:16:01 2008 UTC (15 months, 2 weeks ago) by alexb
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
Initial commit mtk module to sandbox.
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_install().
6 */
7 function id_map_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 db_query('CREATE TABLE {id_map} (
12 `from_table` varchar(128) NOT NULL,
13 `from_id` int(10) NOT NULL,
14 `table` varchar(128) NOT NULL,
15 `key` varchar(64) NOT NULL,
16 `id` int(10) NOT NULL,
17 `valid` int(1) NOT NULL,
18 `custom` text NOT NULL,
19 KEY `table` (`table`,`key`),
20 KEY `id` (`id`),
21 KEY `valid` (`valid`),
22 KEY `from_table` (`from_table`,`from_id`)
23 );');
24 break;
25 }
26 }
27
28 /**
29 * Set module weight to -1, as explained in nodeprofile_install().
30 */
31 function id_map_update_1() {
32 $ret = array();
33 $ret[] = update_sql("ALTER TABLE {id_map} ADD `valid` INT( 1 ) NOT NULL AFTER `id`");
34 $ret[] = update_sql("ALTER TABLE {id_map} ADD INDEX ( `valid` )");
35 return $ret;
36 }
37
38 /**
39 * Implementation of hook_uninstall().
40 */
41 function id_map_uninstall() {
42 db_query('DROP TABLE {id_map};');
43 }

  ViewVC Help
Powered by ViewVC 1.1.2