Added a user_real_name column to the user table, and added a patch SQL file
[lhc/web/wiklou.git] / maintenance / tables.sql
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.
4 --
5 -- Indexes should be defined here; please import the rest from indexes.sql.
6
7 CREATE TABLE user (
8 user_id int(5) unsigned NOT NULL auto_increment,
9 user_name varchar(255) binary NOT NULL default '',
10 user_real_name varchar(255) binary NOT NULL default '',
11 user_rights tinyblob NOT NULL default '',
12 user_password tinyblob NOT NULL default '',
13 user_newpassword tinyblob NOT NULL default '',
14 user_email tinytext NOT NULL default '',
15 user_options blob NOT NULL default '',
16 user_touched char(14) binary NOT NULL default '',
17 UNIQUE KEY user_id (user_id)
18 ) PACK_KEYS=1;
19
20 CREATE TABLE user_newtalk (
21 user_id int(5) NOT NULL default '0',
22 user_ip varchar(40) NOT NULL default ''
23 );
24
25 CREATE TABLE cur (
26 cur_id int(8) unsigned NOT NULL auto_increment,
27 cur_namespace tinyint(2) unsigned NOT NULL default '0',
28 cur_title varchar(255) binary NOT NULL default '',
29 cur_text mediumtext NOT NULL default '',
30 cur_comment tinyblob NOT NULL default '',
31 cur_user int(5) unsigned NOT NULL default '0',
32 cur_user_text varchar(255) binary NOT NULL default '',
33 cur_timestamp char(14) binary NOT NULL default '',
34 cur_restrictions tinyblob NOT NULL default '',
35 cur_counter bigint(20) unsigned NOT NULL default '0',
36 cur_is_redirect tinyint(1) unsigned NOT NULL default '0',
37 cur_minor_edit tinyint(1) unsigned NOT NULL default '0',
38 cur_is_new tinyint(1) unsigned NOT NULL default '0',
39 cur_random real unsigned NOT NULL,
40 cur_touched char(14) binary NOT NULL default '',
41 inverse_timestamp char(14) binary NOT NULL default '',
42 UNIQUE KEY cur_id (cur_id)
43 ) PACK_KEYS=1;
44
45 CREATE TABLE old (
46 old_id int(8) unsigned NOT NULL auto_increment,
47 old_namespace tinyint(2) unsigned NOT NULL default '0',
48 old_title varchar(255) binary NOT NULL default '',
49 old_text mediumtext NOT NULL default '',
50 old_comment tinyblob NOT NULL default '',
51 old_user int(5) unsigned NOT NULL default '0',
52 old_user_text varchar(255) binary NOT NULL,
53 old_timestamp char(14) binary NOT NULL default '',
54 old_minor_edit tinyint(1) NOT NULL default '0',
55 old_flags tinyblob NOT NULL default '',
56 inverse_timestamp char(14) binary NOT NULL default '',
57 UNIQUE KEY old_id (old_id)
58 ) PACK_KEYS=1;
59
60 CREATE TABLE archive (
61 ar_namespace tinyint(2) unsigned NOT NULL default '0',
62 ar_title varchar(255) binary NOT NULL default '',
63 ar_text mediumtext NOT NULL default '',
64 ar_comment tinyblob NOT NULL default '',
65 ar_user int(5) unsigned NOT NULL default '0',
66 ar_user_text varchar(255) binary NOT NULL,
67 ar_timestamp char(14) binary NOT NULL default '',
68 ar_minor_edit tinyint(1) NOT NULL default '0',
69 ar_flags tinyblob NOT NULL default ''
70 ) PACK_KEYS=1;
71
72 --
73 -- Track links that do exist
74 -- l_from and l_to key to cur_id
75 --
76 CREATE TABLE links (
77 l_from int(8) unsigned NOT NULL default '0',
78 l_to int(8) unsigned NOT NULL default '0',
79 UNIQUE KEY l_from(l_from,l_to),
80 KEY (l_to)
81 );
82
83 --
84 -- Track links to pages that don't yet exist.
85 -- bl_from keys to cur_id
86 -- bl_to is a text link (namespace:title)
87 --
88 CREATE TABLE brokenlinks (
89 bl_from int(8) unsigned NOT NULL default '0',
90 bl_to varchar(255) binary NOT NULL default '',
91 UNIQUE KEY bl_from(bl_from,bl_to),
92 KEY (bl_to)
93 );
94
95 --
96 -- Track links to images *used inline*
97 -- il_from keys to cur_id, il_to keys to image_name.
98 -- We don't distinguish live from broken links.
99 --
100 CREATE TABLE imagelinks (
101 il_from int(8) unsigned NOT NULL default '0',
102 il_to varchar(255) binary NOT NULL default '',
103 UNIQUE KEY il_from(il_from,il_to),
104 KEY (il_to)
105 );
106
107 --
108 -- Stores (possibly gzipped) serialized objects with
109 -- cache arrays to reduce database load slurping up
110 -- from links and brokenlinks.
111 --
112 CREATE TABLE linkscc (
113 lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
114 lcc_cacheobj MEDIUMBLOB NOT NULL
115 );
116
117 CREATE TABLE site_stats (
118 ss_row_id int(8) unsigned NOT NULL,
119 ss_total_views bigint(20) unsigned default '0',
120 ss_total_edits bigint(20) unsigned default '0',
121 ss_good_articles bigint(20) unsigned default '0',
122 UNIQUE KEY ss_row_id (ss_row_id)
123 );
124
125 CREATE TABLE hitcounter (
126 hc_id INTEGER UNSIGNED NOT NULL
127 ) TYPE=HEAP MAX_ROWS=25000;
128
129 CREATE TABLE ipblocks (
130 ipb_id int(8) NOT NULL auto_increment,
131 ipb_address varchar(40) binary NOT NULL default '',
132 ipb_user int(8) unsigned NOT NULL default '0',
133 ipb_by int(8) unsigned NOT NULL default '0',
134 ipb_reason tinyblob NOT NULL default '',
135 ipb_timestamp char(14) binary NOT NULL default '',
136 ipb_auto tinyint(1) NOT NULL default '0',
137 ipb_expiry char(14) binary NOT NULL default '',
138 UNIQUE KEY ipb_id (ipb_id)
139 ) PACK_KEYS=1;
140
141 CREATE TABLE image (
142 img_name varchar(255) binary NOT NULL default '',
143 img_size int(8) unsigned NOT NULL default '0',
144 img_description tinyblob NOT NULL default '',
145 img_user int(5) unsigned NOT NULL default '0',
146 img_user_text varchar(255) binary NOT NULL default '',
147 img_timestamp char(14) binary NOT NULL default ''
148 ) PACK_KEYS=1;
149
150 CREATE TABLE oldimage (
151 oi_name varchar(255) binary NOT NULL default '',
152 oi_archive_name varchar(255) binary NOT NULL default '',
153 oi_size int(8) unsigned NOT NULL default 0,
154 oi_description tinyblob NOT NULL default '',
155 oi_user int(5) unsigned NOT NULL default '0',
156 oi_user_text varchar(255) binary NOT NULL default '',
157 oi_timestamp char(14) binary NOT NULL default ''
158 ) PACK_KEYS=1;
159
160 CREATE TABLE recentchanges (
161 rc_timestamp varchar(14) binary NOT NULL default '',
162 rc_cur_time varchar(14) binary NOT NULL default '',
163 rc_user int(10) unsigned NOT NULL default '0',
164 rc_user_text varchar(255) binary NOT NULL default '',
165 rc_namespace tinyint(3) unsigned NOT NULL default '0',
166 rc_title varchar(255) binary NOT NULL default '',
167 rc_comment varchar(255) binary NOT NULL default '',
168 rc_minor tinyint(3) unsigned NOT NULL default '0',
169 rc_bot tinyint(3) unsigned NOT NULL default '0',
170 rc_new tinyint(3) unsigned NOT NULL default '0',
171 rc_cur_id int(10) unsigned NOT NULL default '0',
172 rc_this_oldid int(10) unsigned NOT NULL default '0',
173 rc_last_oldid int(10) unsigned NOT NULL default '0',
174 rc_type tinyint(3) unsigned NOT NULL default '0',
175 rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0',
176 rc_moved_to_title varchar(255) binary NOT NULL default ''
177 ) PACK_KEYS=1;
178
179 CREATE TABLE watchlist (
180 wl_user int(5) unsigned NOT NULL,
181 wl_namespace tinyint(2) unsigned NOT NULL default '0',
182 wl_title varchar(255) binary NOT NULL default '',
183 UNIQUE KEY (wl_user, wl_namespace, wl_title)
184 ) PACK_KEYS=1;
185
186 CREATE TABLE math (
187 math_inputhash varchar(16) NOT NULL,
188 math_outputhash varchar(16) NOT NULL,
189 math_html_conservativeness tinyint(1) NOT NULL,
190 math_html text,
191 math_mathml text,
192 UNIQUE KEY math_inputhash (math_inputhash)
193 );
194
195
196 -- Table searchindex must be MyISAM for fulltext support
197
198 CREATE TABLE searchindex (
199 si_page int(8) unsigned NOT NULL,
200 si_title varchar(255) NOT NULL default '',
201 si_text mediumtext NOT NULL default '',
202 UNIQUE KEY (si_page)
203 ) PACK_KEYS=1;
204
205 CREATE TABLE interwiki (
206 iw_prefix char(32) NOT NULL,
207 iw_url char(127) NOT NULL,
208 iw_local BOOL NOT NULL,
209 UNIQUE KEY iw_prefix (iw_prefix)
210 );
211