aggregator.install 3.55 KB
Newer Older
1
<?php
2
// $Id$
3
4
5
6
7
8

function aggregator_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {aggregator_category} (
9
        cid int NOT NULL auto_increment,
10
11
        title varchar(255) NOT NULL default '',
        description longtext NOT NULL,
12
        block tinyint NOT NULL default '0',
13
14
15
16
17
        PRIMARY KEY (cid),
        UNIQUE KEY title (title)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

      db_query("CREATE TABLE {aggregator_category_feed} (
18
19
        fid int NOT NULL default '0',
        cid int NOT NULL default '0',
20
21
22
23
        PRIMARY KEY (fid,cid)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

      db_query("CREATE TABLE {aggregator_category_item} (
24
25
        iid int NOT NULL default '0',
        cid int NOT NULL default '0',
26
27
28
29
        PRIMARY KEY (iid,cid)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

      db_query("CREATE TABLE {aggregator_feed} (
30
        fid int NOT NULL auto_increment,
31
32
        title varchar(255) NOT NULL default '',
        url varchar(255) NOT NULL default '',
33
34
        refresh int NOT NULL default '0',
        checked int NOT NULL default '0',
35
36
37
38
        link varchar(255) NOT NULL default '',
        description longtext NOT NULL,
        image longtext NOT NULL,
        etag varchar(255) NOT NULL default '',
39
40
        modified int NOT NULL default '0',
        block tinyint NOT NULL default '0',
41
42
43
44
45
46
        PRIMARY KEY (fid),
        UNIQUE KEY link (url),
        UNIQUE KEY title (title)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

      db_query("CREATE TABLE {aggregator_item} (
47
48
        iid int NOT NULL auto_increment,
        fid int NOT NULL default '0',
49
50
51
52
        title varchar(255) NOT NULL default '',
        link varchar(255) NOT NULL default '',
        author varchar(255) NOT NULL default '',
        description longtext NOT NULL,
53
        timestamp int default NULL,
54
        guid varchar(255),
55
56
57
        PRIMARY KEY (iid)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
      break;
    case 'pgsql':
      db_query("CREATE TABLE {aggregator_category} (
        cid serial,
        title varchar(255) NOT NULL default '',
        description text NOT NULL,
        block smallint NOT NULL default '0',
        PRIMARY KEY (cid),
        UNIQUE (title)
      )");

      db_query("CREATE TABLE {aggregator_category_feed} (
        fid int NOT NULL default '0',
        cid int NOT NULL default '0',
        PRIMARY KEY (fid,cid)
      )");

      db_query("CREATE TABLE {aggregator_category_item} (
        iid int NOT NULL default '0',
        cid int NOT NULL default '0',
        PRIMARY KEY (iid,cid)
      )");

      db_query("CREATE TABLE {aggregator_feed} (
        fid serial,
        title varchar(255) NOT NULL default '',
        url varchar(255) NOT NULL default '',
        refresh int NOT NULL default '0',
        checked int NOT NULL default '0',
        link varchar(255) NOT NULL default '',
        description text NOT NULL,
        image text NOT NULL,
        etag varchar(255) NOT NULL default '',
        modified int NOT NULL default '0',
        block smallint NOT NULL default '0',
        PRIMARY KEY (fid),
        UNIQUE (url),
        UNIQUE (title)
      )");

      db_query("CREATE TABLE {aggregator_item} (
        iid serial,
        fid int NOT NULL default '0',
        title varchar(255) NOT NULL default '',
        link varchar(255) NOT NULL default '',
        author varchar(255) NOT NULL default '',
        description text NOT NULL,
        timestamp int default NULL,
        guid varchar(255),
        PRIMARY KEY (iid)
      )");

110
111
112
      break;
  }
}