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