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

Diff of /contributions/modules/og_collections/og_collections.install

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

revision 1.2.2.1, Mon Mar 17 23:55:33 2008 UTC revision 1.2.2.2, Sun Apr 6 20:43:45 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: og_collections.install,v 1.2 2008/03/15 20:16:46 sdboyer Exp $  // $Id: og_collections.install,v 1.2.2.1 2008/03/17 23:55:33 sdboyer Exp $
3    
4  function og_collections_install() {  function og_collections_install() {
5    switch ($GLOBALS['db_type']) {    switch ($GLOBALS['db_type']) {
6      case 'mysql':      case 'mysql':
7      case 'mysqli':      case 'mysqli':
8        db_query("CREATE TABLE {og_collections_pcpanel} (        db_query(<<<EOT
9            CREATE TABLE {og_collections_pcpanel} (
10          did int(11) NOT NULL,          did int(11) NOT NULL,
11          pcpid int(11) NOT NULL,          pcpid int(11) NOT NULL,
12            pcpname varchar(32) NOT NULL,
13          grouptype varchar(32) NOT NULL DEFAULT 'default',          grouptype varchar(32) NOT NULL DEFAULT 'default',
14          version int(4) NOT NULL DEFAULT 0,          version int(4) NOT NULL DEFAULT 0,
15          PRIMARY KEY (did),          PRIMARY KEY (did),
16          KEY group_pcp_id (pcpid, grouptype)          KEY group_pcp_id (pcpid, grouptype)
17        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");        ) /*!40100 DEFAULT CHARACTER SET utf8 */
18    EOT
19          );
20    
21        db_query("CREATE TABLE {og_collections} (        db_query(<<<EOT
22          grouptype varchar(32) NOT NULL,          CREATE TABLE {og_collections} (
23            grouptype varchar(32) NOT NULL,
24            version int(4) NOT NULL DEFAULT 0,
25            defaults text NOT NULL,
26          PRIMARY KEY (grouptype)          PRIMARY KEY (grouptype)
27        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");        ) /*!40100 DEFAULT CHARACTER SET utf8 */
28    EOT
29          );
30    
31        db_query("CREATE TABLE {og_collections_control} (        db_query(<<<EOT
32            CREATE TABLE {og_collections_control} (
33          opdid int(11) NOT NULL,          opdid int(11) NOT NULL,
34          init_pcpdid int(11) NOT NULL,          init_pcpdid int(11) NOT NULL,
35          cur_pcpdid int(11) NULL,          cur_pcpdid int(11) NULL,
# Line 32  function og_collections_install() { Line 42  function og_collections_install() {
42          PRIMARY KEY (opdid),          PRIMARY KEY (opdid),
43          KEY group_pcp_id (pcpid, grouptype),          KEY group_pcp_id (pcpid, grouptype),
44          KEY did_assoc (opdid, cur_pcpdid)          KEY did_assoc (opdid, cur_pcpdid)
45        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); // TODO need to add constraints        ) /*!40100 DEFAULT CHARACTER SET utf8 */
46    EOT
47          ); // TODO need to add constraints
48    
49          db_query(<<<EOT
50            CREATE TABLE {og_collections_versions} (
51            grouptype varchar(32) NOT NULL,
52            vid int(4) NOT NULL DEFAULT 0,
53            data mediumblob,
54            PRIMARY KEY (grouptype, vid)
55          ) /*!40100 DEFAULT CHARACTER SET utf8 */
56    EOT
57          );
58    
59        break;        break;
60    
61      case 'pgsql':      case 'pgsql':
62        db_query("CREATE TABLE {og_collections_pcpanel} (        db_query(<<<EOT
63            CREATE TABLE {og_collections_pcpanel} (
64          did integer(11) NOT NULL,          did integer(11) NOT NULL,
65          pcpid integer(11) NOT NULL,          pcpid integer(11) NOT NULL,
66            pcpname varchar(32) NOT NULL,
67          grouptype varchar(32) NOT NULL DEFAULT 'default',          grouptype varchar(32) NOT NULL DEFAULT 'default',
68          version integer(4) NOT NULL DEFAULT 0,          version integer(4) NOT NULL DEFAULT 0,
69          PRIMARY KEY (did)          PRIMARY KEY (did)
70        );");        )
71    EOT
72          );
73    
74        db_query("CREATE TABLE {og_collections} (        db_query(<<<EOT
75            CREATE TABLE {og_collections} (
76          grouptype varchar(32) NOT NULL,          grouptype varchar(32) NOT NULL,
77            version integer(4) NOT NULL DEFAULT 0,
78            defaults text NOT NULL DEFAULT '0',
79          PRIMARY KEY (grouptype)          PRIMARY KEY (grouptype)
80        );");        )
81    EOT
82          );
83    
84        db_query("CREATE TABLE {og_collections_control} (        db_query(<<<EOT
85            CREATE TABLE {og_collections_control} (
86          opdid integer(11) NOT NULL,          opdid integer(11) NOT NULL,
87          init_pcpdid integer(11) NULL,          init_pcpdid integer(11) NULL,
88          cur_pcpdid integer(11) NULL,          cur_pcpdid integer(11) NULL,
# Line 60  function og_collections_install() { Line 93  function og_collections_install() {
93          version integer(4) NOT NULL DEFAULT 0,          version integer(4) NOT NULL DEFAULT 0,
94          panedata text NOT NULL,          panedata text NOT NULL,
95          PRIMARY KEY (opdid)          PRIMARY KEY (opdid)
96        );");        )
97    EOT
98          );
99    
100          db_query(<<<EOT
101            CREATE TABLE {og_collections_versions} (
102            grouptype varchar(32) NOT NULL,
103            vid integer(4) NOT NULL DEFAULT 0,
104            data mediumblob,
105            PRIMARY KEY (grouptype, vid)
106          )
107    EOT
108          );
109    
110        break;        break;
111    }    }
112    db_query("INSERT INTO {og_collections} (grouptype) VALUES ('default')"); // pre-configured panel functions can react badly if there is no default row already created    db_query("INSERT INTO {og_collections} (grouptype, version, defaults) VALUES ('default', 0, '0')"); // pre-configured panel functions can react badly if there is no default row already created
113  }  }
114    
115  function og_collections_update_5001() {  function og_collections_update_5001() {
# Line 119  function og_collections_uninstall() { Line 164  function og_collections_uninstall() {
164    db_query('DROP TABLE {og_collections_pcpanel}');    db_query('DROP TABLE {og_collections_pcpanel}');
165    db_query('DROP TABLE {og_collections');    db_query('DROP TABLE {og_collections');
166    db_query('DROP TABLE {og_collections_control}');    db_query('DROP TABLE {og_collections_control}');
167      db_query('DROP TABLE {og_collections_versions');
168    
169    // Delete variables    // Delete variables
170    $variables = array('og_collections_settings');    $variables = array('og_collections_settings');

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2

  ViewVC Help
Powered by ViewVC 1.1.2