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