/[drupal]/contributions/modules/openresort/terms/terms.install
ViewVC logotype

Contents of /contributions/modules/openresort/terms/terms.install

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


Revision 1.5 - (show annotations) (download) (as text)
Wed Jan 2 22:14:26 2008 UTC (22 months, 3 weeks ago) by marcingy
Branch: MAIN
CVS Tags: DRUPAL-5--1-15-1, DRUPAL-5--1-15-2, DRUPAL-5--1-16-6, DRUPAL-5--1-16-4, DRUPAL-5--1-16-5, DRUPAL-5--1-16-2, DRUPAL-5--1-16-3, DRUPAL-5--1-16-1, DRUPAL-5--1-15, DRUPAL-5--1-16, HEAD
Changes since 1.4: +0 -0 lines
File MIME type: text/x-php
*** empty log message ***
1 <?php
2 // $Id: $
3
4 function terms_install() {
5 switch ($GLOBALS['db_type']) {
6 case 'pgsql':
7 case 'mysql':
8 case 'mysqli':
9 db_query("CREATE TABLE {business_terms} (
10 tid int(10) unsigned NOT NULL auto_increment,
11 sid int(10) unsigned NOT NULL default '0',
12 name varchar(255) NOT NULL default '',
13 description longtext NOT NULL,
14 weight tinyint(4) NOT NULL default '0',
15 isdefault tinyint(3) unsigned NOT NULL default '0',
16 PRIMARY KEY (tid),
17 KEY sid (sid)
18 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
19 db_query("CREATE TABLE {business_terms_relation} (
20 tid int(10) unsigned NOT NULL default '0',
21 nid int(10) unsigned NOT NULL default '0',
22 PRIMARY KEY (tid,nid),
23 KEY tid (tid),
24 KEY nid (nid)
25 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
26 db_query("CREATE TABLE {business_terms_sections} (
27 sid int(10) unsigned NOT NULL auto_increment,
28 name varchar(255) NOT NULL default '',
29 description longtext,
30 weight tinyint(4) NOT NULL default '0',
31 multiple tinyint(3) unsigned NOT NULL default '0',
32 PRIMARY KEY (sid)
33 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
34 db_query("CREATE TABLE {business_section_node_types} (
35 sid int(10) unsigned NOT NULL default '0',
36 type varchar(32) NOT NULL default '',
37 required tinyint(3) unsigned NOT NULL default '0',
38 PRIMARY KEY (sid,type)
39 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
40 break;
41 }
42
43 // Enable terms by default
44 db_query("UPDATE {system} SET status = 1 WHERE name = 'terms'");
45
46 // Notify of changes
47 drupal_set_message(t('Business terms module was successfully installed with default options. To customize default terms, please view the <a href="%settings">terms settings page</a>.', array('%settings' => url('admin/business/terms'))));
48
49 }
50
51 /**
52 * Updates to terms
53 */
54 function terms_update_1() {
55 $items = array();
56 $items[] = update_sql("ALTER TABLE {business_terms} ADD isdefault tinyint(3) unsigned NOT NULL default '0'");
57 return $items;
58 }
59 function terms_update_2() {
60 $items = array();
61 $items[] = update_sql("ALTER TABLE {business_terms_sections} DROP help");
62 $items[] = update_sql("ALTER TABLE {business_terms_sections} ADD multiple tinyint(3) unsigned NOT NULL default '0'");
63 return $items;
64 }
65
66 function terms_update_3() {
67 $items = array();
68 $items[] = update_sql("ALTER TABLE {business_terms_relation} ADD PRIMARY KEY(tid, nid)");
69 return $items;
70 }
71
72 function terms_update_4(){
73 $items = array();
74 $items[] = update_sql("ALTER TABLE {business_terms_sections} DROP help");
75 $items[] = update_sql("ALTER TABLE {business_terms} ADD isdefault tinyint(3) unsigned NOT NULL default '0'");
76 $items[] = update_sql("ALTER TABLE {business_terms_sections} ADD multiple tinyint(3) unsigned NOT NULL default '0'");
77 return $items;
78 }

  ViewVC Help
Powered by ViewVC 1.1.2