Only allow identified users to mark edits as minor
[mediawiki.git] / maintenance / tables.sql
blob8a9d79a729a8f9a84ace849eacdd7acf98773d2b
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 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
98 ) TYPE=MyISAM;
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 ''
104 ) TYPE=MyISAM;
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)
113 ) TYPE=MyISAM;
115 DROP TABLE IF EXISTS hitcounter;
116 CREATE TABLE hitcounter (
117   hc_id INTEGER UNSIGNED NOT NULL
118 ) TYPE=HEAP MAX_ROWS=25000;
120 DROP TABLE IF EXISTS ipblocks;
121 CREATE TABLE ipblocks (
122   ipb_id int(8) NOT NULL auto_increment,
123   ipb_address varchar(40) binary NOT NULL default '',
124   ipb_user int(8) unsigned NOT NULL default '0',
125   ipb_by int(8) unsigned NOT NULL default '0',
126   ipb_reason tinyblob NOT NULL default '',
127   ipb_timestamp char(14) binary NOT NULL default '',
128   ipb_auto tinyint(1) NOT NULL default '0',
129   UNIQUE KEY ipb_id (ipb_id)
130 ) TYPE=MyISAM PACK_KEYS=1;
132 DROP TABLE IF EXISTS image;
133 CREATE TABLE image (
134   img_name varchar(255) binary NOT NULL default '',
135   img_size int(8) unsigned NOT NULL default '0',
136   img_description tinyblob NOT NULL default '',
137   img_user int(5) unsigned NOT NULL default '0',
138   img_user_text varchar(255) binary NOT NULL default '',
139   img_timestamp char(14) binary NOT NULL default ''
140 ) TYPE=MyISAM PACK_KEYS=1;
142 DROP TABLE IF EXISTS oldimage;
143 CREATE TABLE oldimage (
144   oi_name varchar(255) binary NOT NULL default '',
145   oi_archive_name varchar(255) binary NOT NULL default '',
146   oi_size int(8) unsigned NOT NULL default 0,
147   oi_description tinyblob NOT NULL default '',
148   oi_user int(5) unsigned NOT NULL default '0',
149   oi_user_text varchar(255) binary NOT NULL default '',
150   oi_timestamp char(14) binary NOT NULL default ''
151 ) TYPE=MyISAM PACK_KEYS=1;
153 DROP TABLE IF EXISTS recentchanges;
154 CREATE TABLE recentchanges (
155   rc_timestamp varchar(14) binary NOT NULL default '',
156   rc_cur_time varchar(14) binary NOT NULL default '',
157   rc_user int(10) unsigned NOT NULL default '0',
158   rc_user_text varchar(255) binary NOT NULL default '',
159   rc_namespace tinyint(3) unsigned NOT NULL default '0',
160   rc_title varchar(255) binary NOT NULL default '',
161   rc_comment varchar(255) binary NOT NULL default '',
162   rc_minor tinyint(3) unsigned NOT NULL default '0',
163   rc_bot tinyint(3) unsigned NOT NULL default '0',
164   rc_new tinyint(3) unsigned NOT NULL default '0',
165   rc_cur_id int(10) unsigned NOT NULL default '0',
166   rc_this_oldid int(10) unsigned NOT NULL default '0',
167   rc_last_oldid int(10) unsigned NOT NULL default '0',
168   rc_type tinyint(3) unsigned NOT NULL default '0',
169   rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0',
170   rc_moved_to_title varchar(255) binary NOT NULL default '',
171 ) TYPE=MyISAM PACK_KEYS=1;
173 DROP TABLE IF EXISTS watchlist;
174 CREATE TABLE watchlist (
175   wl_user int(5) unsigned NOT NULL,
176   wl_namespace tinyint(2) unsigned NOT NULL default '0',
177   wl_title varchar(255) binary NOT NULL default '',
178   UNIQUE KEY (wl_user, wl_namespace, wl_title)
179 ) TYPE=MyISAM PACK_KEYS=1;
181 DROP TABLE IF EXISTS math;
182 CREATE TABLE math (
183   math_inputhash varchar(16) NOT NULL,
184   math_outputhash varchar(16) NOT NULL,
185   math_html_conservativeness tinyint(1) NOT NULL,
186   math_html text,
187   math_mathml text,
188   UNIQUE KEY math_inputhash (math_inputhash)
189 ) TYPE=MyISAM;
192 -- Table searchindex must be MyISAM for fulltext support
194 DROP TABLE IF EXISTS searchindex;
195 CREATE TABLE searchindex (
196   si_page int(8) unsigned NOT NULL,
197   si_title varchar(255) NOT NULL default '',
198   si_text mediumtext NOT NULL default '',
199   UNIQUE KEY (si_page)
200 ) TYPE=MyISAM PACK_KEYS=1;
202 DROP TABLE IF EXISTS interwiki;
203 CREATE TABLE interwiki (
204   iw_prefix char(32) NOT NULL,
205   iw_url char(127) NOT NULL,
206   iw_local BOOL NOT NULL,
207   UNIQUE KEY iw_prefix (iw_prefix)