1 -- SQL to create the initial tables for the Wikipedia database.
2 -- This is read and executed by the install script; you should
3 -- never have to run it by itself.
5 -- Only UNIQUE keys are defined here; the rest are added by
8 -- If you change the main development branch version of this
9 -- file, please add an appropriate ALTER TABLE to update.php,
10 -- and increment the version number in Version.php.
12 DROP TABLE IF EXISTS user;
14 user_id
int(5) unsigned
NOT NULL auto_increment
,
15 user_name
varchar(255) binary NOT NULL default '',
16 user_rights tinyblob
NOT NULL default '',
17 user_password tinyblob
NOT NULL default '',
18 user_newpassword tinyblob
NOT NULL default '',
19 user_email tinytext
NOT NULL default '',
20 user_options
blob NOT NULL default '',
21 user_touched
char(14) binary NOT NULL default '',
22 UNIQUE KEY user_id (user_id
)
23 ) TYPE=MyISAM PACK_KEYS
=1;
25 DROP TABLE IF EXISTS user_newtalk
;
26 CREATE TABLE user_newtalk (
27 user_id
int(5) NOT NULL default '0',
28 user_ip
varchar(40) NOT NULL default ''
31 DROP TABLE IF EXISTS cur
;
33 cur_id
int(8) unsigned
NOT NULL auto_increment
,
34 cur_namespace
tinyint(2) unsigned
NOT NULL default '0',
35 cur_title
varchar(255) binary NOT NULL default '',
36 cur_text mediumtext
NOT NULL default '',
37 cur_comment tinyblob
NOT NULL default '',
38 cur_user
int(5) unsigned
NOT NULL default '0',
39 cur_user_text
varchar(255) binary NOT NULL default '',
40 cur_timestamp
char(14) binary NOT NULL default '',
41 cur_restrictions tinyblob
NOT NULL default '',
42 cur_counter
bigint(20) unsigned
NOT NULL default '0',
43 cur_is_redirect
tinyint(1) unsigned
NOT NULL default '0',
44 cur_minor_edit
tinyint(1) unsigned
NOT NULL default '0',
45 cur_is_new
tinyint(1) unsigned
NOT NULL default '0',
46 cur_random
real unsigned
NOT NULL,
47 cur_touched
char(14) binary NOT NULL default '',
48 inverse_timestamp
char(14) binary NOT NULL default '',
49 UNIQUE KEY cur_id (cur_id
)
50 ) TYPE=MyISAM PACK_KEYS
=1;
52 DROP TABLE IF EXISTS old;
54 old_id
int(8) unsigned
NOT NULL auto_increment
,
55 old_namespace
tinyint(2) unsigned
NOT NULL default '0',
56 old_title
varchar(255) binary NOT NULL default '',
57 old_text mediumtext
NOT NULL default '',
58 old_comment tinyblob
NOT NULL default '',
59 old_user
int(5) unsigned
NOT NULL default '0',
60 old_user_text
varchar(255) binary NOT NULL,
61 old_timestamp
char(14) binary NOT NULL default '',
62 old_minor_edit
tinyint(1) NOT NULL default '0',
63 old_flags tinyblob
NOT NULL default '',
64 inverse_timestamp
char(14) binary NOT NULL default '',
65 UNIQUE KEY old_id (old_id
)
66 ) TYPE=MyISAM PACK_KEYS
=1;
68 DROP TABLE IF EXISTS archive
;
69 CREATE TABLE archive (
70 ar_namespace
tinyint(2) unsigned
NOT NULL default '0',
71 ar_title
varchar(255) binary NOT NULL default '',
72 ar_text mediumtext
NOT NULL default '',
73 ar_comment tinyblob
NOT NULL default '',
74 ar_user
int(5) unsigned
NOT NULL default '0',
75 ar_user_text
varchar(255) binary NOT NULL,
76 ar_timestamp
char(14) binary NOT NULL default '',
77 ar_minor_edit
tinyint(1) NOT NULL default '0',
78 ar_flags tinyblob
NOT NULL default ''
79 ) TYPE=MyISAM PACK_KEYS
=1;
81 DROP TABLE IF EXISTS links
;
83 l_from
varchar(255) binary NOT NULL default '',
84 l_to
int(8) unsigned
NOT NULL default '0'
87 DROP TABLE IF EXISTS brokenlinks
;
88 CREATE TABLE brokenlinks (
89 bl_from
int(8) unsigned
NOT NULL default '0',
90 bl_to
varchar(255) binary NOT NULL default ''
93 DROP TABLE IF EXISTS linkscc
;
94 CREATE TABLE linkscc (
95 lcc_pageid
INT UNSIGNED
NOT NULL UNIQUE KEY,
96 lcc_title
VARCHAR(255) NOT NULL UNIQUE KEY,
97 lcc_cacheobj MEDIUMBLOB
NOT NULL
100 DROP TABLE IF EXISTS imagelinks
;
101 CREATE TABLE imagelinks (
102 il_from
varchar(255) binary NOT NULL default '',
103 il_to
varchar(255) binary NOT NULL default ''
106 DROP TABLE IF EXISTS site_stats
;
107 CREATE TABLE site_stats (
108 ss_row_id
int(8) unsigned
NOT NULL,
109 ss_total_views
bigint(20) unsigned
default '0',
110 ss_total_edits
bigint(20) unsigned
default '0',
111 ss_good_articles
bigint(20) unsigned
default '0',
112 UNIQUE KEY ss_row_id (ss_row_id
)
115 DROP TABLE IF EXISTS ipblocks
;
116 CREATE TABLE ipblocks (
117 ipb_id
int(8) NOT NULL auto_increment
,
118 ipb_address
varchar(40) binary NOT NULL default '',
119 ipb_user
int(8) unsigned
NOT NULL default '0',
120 ipb_by
int(8) unsigned
NOT NULL default '0',
121 ipb_reason tinyblob
NOT NULL default '',
122 ipb_timestamp
char(14) binary NOT NULL default '',
123 ipb_auto
tinyint(1) NOT NULL default '0',
124 UNIQUE KEY ipb_id (ipb_id
)
125 ) TYPE=MyISAM PACK_KEYS
=1;
127 DROP TABLE IF EXISTS image
;
129 img_name
varchar(255) binary NOT NULL default '',
130 img_size
int(8) unsigned
NOT NULL default '0',
131 img_description tinyblob
NOT NULL default '',
132 img_user
int(5) unsigned
NOT NULL default '0',
133 img_user_text
varchar(255) binary NOT NULL default '',
134 img_timestamp
char(14) binary NOT NULL default ''
135 ) TYPE=MyISAM PACK_KEYS
=1;
137 DROP TABLE IF EXISTS oldimage
;
138 CREATE TABLE oldimage (
139 oi_name
varchar(255) binary NOT NULL default '',
140 oi_archive_name
varchar(255) binary NOT NULL default '',
141 oi_size
int(8) unsigned
NOT NULL default 0,
142 oi_description tinyblob
NOT NULL default '',
143 oi_user
int(5) unsigned
NOT NULL default '0',
144 oi_user_text
varchar(255) binary NOT NULL default '',
145 oi_timestamp
char(14) binary NOT NULL default ''
146 ) TYPE=MyISAM PACK_KEYS
=1;
148 DROP TABLE IF EXISTS recentchanges
;
149 CREATE TABLE recentchanges (
150 rc_timestamp
varchar(14) binary NOT NULL default '',
151 rc_cur_time
varchar(14) binary NOT NULL default '',
152 rc_user
int(10) unsigned
NOT NULL default '0',
153 rc_user_text
varchar(255) binary NOT NULL default '',
154 rc_namespace
tinyint(3) unsigned
NOT NULL default '0',
155 rc_title
varchar(255) binary NOT NULL default '',
156 rc_comment
varchar(255) binary NOT NULL default '',
157 rc_minor
tinyint(3) unsigned
NOT NULL default '0',
158 rc_bot
tinyint(3) unsigned
NOT NULL default '0',
159 rc_new
tinyint(3) unsigned
NOT NULL default '0',
160 rc_cur_id
int(10) unsigned
NOT NULL default '0',
161 rc_this_oldid
int(10) unsigned
NOT NULL default '0',
162 rc_last_oldid
int(10) unsigned
NOT NULL default '0'
163 ) TYPE=MyISAM PACK_KEYS
=1;
165 DROP TABLE IF EXISTS watchlist
;
166 CREATE TABLE watchlist (
167 wl_user
int(5) unsigned
NOT NULL,
168 wl_namespace
tinyint(2) unsigned
NOT NULL default '0',
169 wl_title
varchar(255) binary NOT NULL default '',
170 UNIQUE KEY (wl_user
, wl_namespace
, wl_title
)
171 ) TYPE=MyISAM PACK_KEYS
=1;
173 DROP TABLE IF EXISTS math
;
175 math_inputhash
varchar(16) NOT NULL,
176 math_outputhash
varchar(16) NOT NULL,
177 math_html_conservativeness
tinyint(1) NOT NULL,
180 UNIQUE KEY math_inputhash (math_inputhash
)
184 -- Table searchindex must be MyISAM for fulltext support
186 DROP TABLE IF EXISTS searchindex
;
187 CREATE TABLE searchindex (
188 si_page
int(8) unsigned
NOT NULL,
189 si_title
varchar(255) NOT NULL default '',
190 si_text mediumtext
NOT NULL default '',
192 ) TYPE=MyISAM PACK_KEYS
=1;
194 DROP TABLE IF EXISTS interwiki
;
195 CREATE TABLE interwiki (
196 iw_prefix
char(32) NOT NULL,
197 iw_url
char(127) NOT NULL,
198 iw_local BOOL
NOT NULL,
199 UNIQUE KEY iw_prefix (iw_prefix
)