summaryrefslogtreecommitdiffstats
path: root/panels.install
blob: 9aeb3b6821ab1656fb4e5f8f4611103b2e084369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
// $Id$

/**
 * Install the panels tables
 */
function panels_install() {
  switch ($GLOBALS['dbtype']) {
    case 'pgsql':
      db_query(<<<EOT
        CREATE TABLE {panels_info} (
          did int not null default 0 primary key,
          title varchar(128),
          access varchar(128),
          path varchar(128),
          css_id varchar(128),
          layout varchar(32)
        );
EOT
      );
      
      db_query("CREATE SEQUENCE {panels_info}_id_seq;");
  
      db_query(<<<EOT
        CREATE TABLE {panels_area} (
          did int NOT NULL DEFAULT 0,
          area varchar(32),
          type varchar(32),
          configuration text,
          position int
        );
EOT
  );
  
      db_query("CREATE INDEX {panels_area}_did_idx ON {panels_area} (did);");
      break;
    case 'mysql':
    case 'mysqli':
    default:
      db_query(<<<EOT
        create table {panels_info} (
          did int(10) not null default 0 primary key,
          title varchar(128),
          access varchar(128),
          path varchar(128),
          css_id varchar(128),
          layout varchar(32)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */
EOT
      );
      db_query(<<<EOT
        create table {panels_area} (
          did int(10) not null default 0,
          area varchar(32),
          type varchar(32),
          configuration longtext,
          position int(5),
          key (did)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */
EOT
  );
  }
}

/**
 * Uninstall the panels tables
 */
function panels_uninstall() {
  switch ($GLOBALS['db_type']) {
    case 'pgsql':
    case 'mysql':
    case 'mysqli':
    default:
      db_query("DROP TABLE {panels_info}");
      db_query("DROP TABLE {panels_area}");
  }
}

/**
 * Update the tables to UTF-8
 */
function panels_update_1() {
  return _system_update_utf8(array('panels_info', 'panels_area'));
}