]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/unit/mysql-test-initialize.sql
fixes for new dumphtml API
[SourceForge/phpwiki.git] / tests / unit / mysql-test-initialize.sql
1 -- $Id: mysql-test-initialize.sql,v 1.3 2004-12-22 15:05:18 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         INDEX (linkfrom),
58         INDEX (linkto)
59 );
60
61 CREATE TABLE test_session (
62         sess_id         CHAR(32) NOT NULL DEFAULT '',
63         sess_data       BLOB NOT NULL,
64         sess_date       INT UNSIGNED NOT NULL,
65         sess_ip         CHAR(15) NOT NULL,
66         PRIMARY KEY (sess_id),
67         INDEX (sess_date)
68 ); -- TYPE=heap; -- if your Mysql supports it and you have enough RAM
69
70 -- upgrade to 1.3.8: (see lib/upgrade.php)
71 -- ALTER TABLE session ADD sess_ip CHAR(15) NOT NULL;
72 -- CREATE INDEX sess_date on session (sess_date);
73 -- update to 1.3.10: (see lib/upgrade.php)
74 -- ALTER TABLE page CHANGE id id INT NOT NULL AUTO_INCREMENT;
75
76 -- Optional DB Auth and Prefs
77 -- For these tables below the default table prefix must be used 
78 -- in the DBAuthParam SQL statements also.
79
80 CREATE TABLE test_pref (
81         userid  CHAR(48) BINARY NOT NULL UNIQUE,
82         prefs   TEXT NULL DEFAULT '',
83         PRIMARY KEY (userid)
84 ) TYPE=MyISAM;
85
86 -- better use the extra pref table where such users can be created easily 
87 -- without password.
88 CREATE TABLE test_user (
89         userid  CHAR(48) BINARY NOT NULL UNIQUE,
90         passwd  CHAR(48) BINARY DEFAULT '',
91 --      prefs   TEXT NULL DEFAULT '',
92 --      groupname CHAR(48) BINARY DEFAULT 'users',
93         PRIMARY KEY (userid)
94 ) TYPE=MyISAM;
95
96 -- only if you plan to use the wikilens theme
97 CREATE TABLE test_rating (
98         dimension INT(4) NOT NULL,
99         raterpage INT(11) NOT NULL,
100         rateepage INT(11) NOT NULL,
101         ratingvalue FLOAT NOT NULL,
102         rateeversion INT(11) NOT NULL,
103         tstamp TIMESTAMP(14) NOT NULL,
104         PRIMARY KEY (dimension, raterpage, rateepage)
105 );
106
107 -- only if you need fast log-analysis (spam prevention, recent referrers)
108 -- see http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178
109 CREATE TABLE test_accesslog (
110         time_stamp    int unsigned,
111         remote_host   varchar(50),
112         remote_user   varchar(50),
113         request_method varchar(10),
114         request_line  varchar(255),
115         request_args  varchar(255),
116         request_file  varchar(255),
117         request_uri   varchar(255),
118         request_time  char(28),
119         status        smallint unsigned,
120         bytes_sent    smallint unsigned,
121         referer       varchar(255), 
122         agent         varchar(255),
123         request_duration float
124 );
125 CREATE INDEX log_time ON test_accesslog (time_stamp);
126 CREATE INDEX log_host ON test_accesslog (remote_host);