]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/unit/mysql-test-initialize.sql
Initialize $html
[SourceForge/phpwiki.git] / tests / unit / mysql-test-initialize.sql
1 -- for the regression suite
2
3 drop table if exists test_page;
4 drop table if exists test_version;
5 drop table if exists test_recent;
6 drop table if exists test_nonempty;
7 drop table if exists test_link;
8 drop table if exists test_session;
9
10 -- since 1.3.7:
11
12 drop table if exists test_pref;
13 drop table if exists test_user;
14 drop table if exists test_member;
15
16 drop table if exists test_rating;
17 drop table if exists test_accesslog;
18
19 CREATE TABLE test_page (
20         id              INT NOT NULL AUTO_INCREMENT,
21         pagename        VARCHAR(100) BINARY NOT NULL,
22         hits            INT NOT NULL DEFAULT 0,
23         pagedata        MEDIUMTEXT NOT NULL DEFAULT '',
24         cached_html     MEDIUMBLOB,
25         PRIMARY KEY (id),
26         UNIQUE KEY (pagename)
27 );
28
29 CREATE TABLE test_version (
30         id              INT NOT NULL,
31         version         INT NOT NULL,
32         mtime           INT NOT NULL,
33         minor_edit      TINYINT DEFAULT 0,
34         content         MEDIUMTEXT NOT NULL DEFAULT '',
35         versiondata     MEDIUMTEXT NOT NULL DEFAULT '',
36         PRIMARY KEY (id,version),
37         INDEX (mtime)
38 );
39
40 CREATE TABLE test_recent (
41         id              INT NOT NULL,
42         latestversion   INT,
43         latestmajor     INT,
44         latestminor     INT,
45         PRIMARY KEY (id)
46 );
47
48 CREATE TABLE test_nonempty (
49         id              INT NOT NULL,
50         PRIMARY KEY (id)
51 );
52
53 CREATE TABLE test_link (
54         linkfrom        INT NOT NULL,
55         linkto          INT NOT NULL,
56         relation        INT DEFAULT 0,
57         INDEX (linkfrom),
58         INDEX (linkto),
59         INDEX (relation)
60 );
61
62 CREATE TABLE test_session (
63         sess_id         CHAR(32) NOT NULL DEFAULT '',
64         sess_data       BLOB NOT NULL,
65         sess_date       INT UNSIGNED NOT NULL,
66         sess_ip         CHAR(15) NOT NULL,
67         PRIMARY KEY (sess_id),
68         INDEX (sess_date)
69 ); -- TYPE=heap; -- if your Mysql supports it and you have enough RAM
70
71 -- upgrade to 1.3.8: (see lib/upgrade.php)
72 -- ALTER TABLE session ADD sess_ip CHAR(15) NOT NULL;
73 -- CREATE INDEX sess_date on session (sess_date);
74 -- update to 1.3.10: (see lib/upgrade.php)
75 -- ALTER TABLE page CHANGE id id INT NOT NULL AUTO_INCREMENT;
76
77 -- Optional DB Auth and Prefs
78 -- For these tables below the default table prefix must be used 
79 -- in the DBAuthParam SQL statements also.
80
81 CREATE TABLE test_pref (
82         userid  CHAR(48) BINARY NOT NULL UNIQUE,
83         prefs   TEXT NULL DEFAULT '',
84         PRIMARY KEY (userid)
85 );
86
87 -- better use the extra pref table where such users can be created easily 
88 -- without password.
89 --CREATE TABLE test_user (
90 --      userid  CHAR(48) BINARY NOT NULL UNIQUE,
91 --      passwd  CHAR(48) BINARY DEFAULT '',
92 --      prefs   TEXT NULL DEFAULT '',
93 --      groupname CHAR(48) BINARY DEFAULT 'users',
94 --      PRIMARY KEY (userid)
95 --) TYPE=MyISAM;
96
97 -- only if you plan to use the wikilens theme
98 CREATE TABLE test_rating (
99         dimension INT(4) NOT NULL,
100         raterpage INT(11) NOT NULL,
101         rateepage INT(11) NOT NULL,
102         ratingvalue FLOAT NOT NULL,
103         rateeversion INT(11) NOT NULL,
104         tstamp TIMESTAMP(14) NOT NULL,
105         PRIMARY KEY (dimension, raterpage, rateepage)
106 );
107
108 -- only if you need fast log-analysis (spam prevention, recent referrers)
109 -- see http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178
110 CREATE TABLE test_accesslog (
111         time_stamp    int unsigned,
112         remote_host   varchar(50),
113         remote_user   varchar(50),
114         request_method varchar(10),
115         request_line  varchar(255),
116         request_args  varchar(255),
117         request_file  varchar(255),
118         request_uri   varchar(255),
119         request_time  char(28),
120         status        smallint unsigned,
121         bytes_sent    smallint unsigned,
122         referer       varchar(255), 
123         agent         varchar(255),
124         request_duration float
125 );
126 CREATE INDEX log_time ON test_accesslog (time_stamp);
127 CREATE INDEX log_host ON test_accesslog (remote_host);