Minor spelling fix
[mediawiki.git] / maintenance / tables.sql
blob201a9462f856528b75db7aa2289ef1b29b970196
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 -- Only UNIQUE keys are defined here; the rest are added by
6 -- indexes.sql.
7 --
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;
13 CREATE TABLE 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;
24         
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 ''
29 ) TYPE=MyISAM;
31 DROP TABLE IF EXISTS cur;
32 CREATE TABLE 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;
53 CREATE TABLE 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;
82 CREATE TABLE links (
83   l_from varchar(255) binary NOT NULL default '',
84   l_to int(8) unsigned NOT NULL default '0'
85 ) TYPE=MyISAM;
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 ''
91 ) TYPE=MyISAM;
93 DROP TABLE IF EXISTS imagelinks;
94 CREATE TABLE imagelinks (
95   il_from varchar(255) binary NOT NULL default '',
96   il_to varchar(255) binary NOT NULL default ''
97 ) TYPE=MyISAM;
99 DROP TABLE IF EXISTS site_stats;
100 CREATE TABLE site_stats (
101   ss_row_id int(8) unsigned NOT NULL,
102   ss_total_views bigint(20) unsigned default '0',
103   ss_total_edits bigint(20) unsigned default '0',
104   ss_good_articles bigint(20) unsigned default '0',
105   UNIQUE KEY ss_row_id (ss_row_id)
106 ) TYPE=MyISAM;
108 DROP TABLE IF EXISTS ipblocks;
109 CREATE TABLE ipblocks (
110   ipb_id int(8) NOT NULL auto_increment,
111   ipb_address varchar(40) binary NOT NULL default '',
112   ipb_user int(8) unsigned NOT NULL default '0',
113   ipb_by int(8) unsigned NOT NULL default '0',
114   ipb_reason tinyblob NOT NULL default '',
115   ipb_timestamp char(14) binary NOT NULL default '',
116   ipb_auto tinyint(1) NOT NULL default '0',
117   UNIQUE KEY ipb_id (ipb_id)
118 ) TYPE=MyISAM PACK_KEYS=1;
120 DROP TABLE IF EXISTS image;
121 CREATE TABLE image (
122   img_name varchar(255) binary NOT NULL default '',
123   img_size int(8) unsigned NOT NULL default '0',
124   img_description tinyblob NOT NULL default '',
125   img_user int(5) unsigned NOT NULL default '0',
126   img_user_text varchar(255) binary NOT NULL default '',
127   img_timestamp char(14) binary NOT NULL default ''
128 ) TYPE=MyISAM PACK_KEYS=1;
130 DROP TABLE IF EXISTS oldimage;
131 CREATE TABLE oldimage (
132   oi_name varchar(255) binary NOT NULL default '',
133   oi_archive_name varchar(255) binary NOT NULL default '',
134   oi_size int(8) unsigned NOT NULL default 0,
135   oi_description tinyblob NOT NULL default '',
136   oi_user int(5) unsigned NOT NULL default '0',
137   oi_user_text varchar(255) binary NOT NULL default '',
138   oi_timestamp char(14) binary NOT NULL default ''
139 ) TYPE=MyISAM PACK_KEYS=1;
141 DROP TABLE IF EXISTS recentchanges;
142 CREATE TABLE recentchanges (
143   rc_timestamp varchar(14) binary NOT NULL default '',
144   rc_cur_time varchar(14) binary NOT NULL default '',
145   rc_user int(10) unsigned NOT NULL default '0',
146   rc_user_text varchar(255) binary NOT NULL default '',
147   rc_namespace tinyint(3) unsigned NOT NULL default '0',
148   rc_title varchar(255) binary NOT NULL default '',
149   rc_comment varchar(255) binary NOT NULL default '',
150   rc_minor tinyint(3) unsigned NOT NULL default '0',
151   rc_bot tinyint(3) unsigned NOT NULL default '0',
152   rc_new tinyint(3) unsigned NOT NULL default '0',
153   rc_cur_id int(10) unsigned NOT NULL default '0',
154   rc_this_oldid int(10) unsigned NOT NULL default '0',
155   rc_last_oldid int(10) unsigned NOT NULL default '0'
156 ) TYPE=MyISAM PACK_KEYS=1;
158 DROP TABLE IF EXISTS watchlist;
159 CREATE TABLE watchlist (
160   wl_user int(5) unsigned NOT NULL,
161   wl_namespace tinyint(2) unsigned NOT NULL default '0',
162   wl_title varchar(255) binary NOT NULL default '',
163   UNIQUE KEY (wl_user, wl_namespace, wl_title)
164 ) TYPE=MyISAM PACK_KEYS=1;
166 DROP TABLE IF EXISTS math;
167 CREATE TABLE math (
168   math_inputhash varchar(16) NOT NULL,
169   math_outputhash varchar(16) NOT NULL,
170   math_html_conservativeness tinyint(1) NOT NULL,
171   math_html text,
172   math_mathml text,
173   UNIQUE KEY math_inputhash (math_inputhash)
174 ) TYPE=MyISAM;
176 -- Table searchindex must be MyISAM for fulltext support
178 DROP TABLE IF EXISTS searchindex;
179 CREATE TABLE searchindex (
180   si_page int(8) unsigned NOT NULL,
181   si_title varchar(255) NOT NULL default '',
182   si_text mediumtext NOT NULL default '',
183   UNIQUE KEY (si_page)
184 ) TYPE=MyISAM PACK_KEYS=1;
186 DROP TABLE IF EXISTS interwiki;
187 CREATE TABLE interwiki (
188   iw_prefix char(32) NOT NULL,
189   iw_url char(127) NOT NULL,
190   iw_local BOOL NOT NULL,
191   UNIQUE KEY iw_prefix (iw_prefix)