Purging of scaled images when thumbnail is regenerated. Depends on visiting the page...
[mediawiki.git] / maintenance / tables.sql
blob71f55259d3621bac9b12168368bfb42b062d6e54
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   ipb_expiry char(14) binary NOT NULL default '',
130   UNIQUE KEY ipb_id (ipb_id)
131 ) TYPE=MyISAM PACK_KEYS=1;
133 DROP TABLE IF EXISTS image;
134 CREATE TABLE image (
135   img_name varchar(255) binary NOT NULL default '',
136   img_size int(8) unsigned NOT NULL default '0',
137   img_description tinyblob NOT NULL default '',
138   img_user int(5) unsigned NOT NULL default '0',
139   img_user_text varchar(255) binary NOT NULL default '',
140   img_timestamp char(14) binary NOT NULL default ''
141 ) TYPE=MyISAM PACK_KEYS=1;
143 DROP TABLE IF EXISTS oldimage;
144 CREATE TABLE oldimage (
145   oi_name varchar(255) binary NOT NULL default '',
146   oi_archive_name varchar(255) binary NOT NULL default '',
147   oi_size int(8) unsigned NOT NULL default 0,
148   oi_description tinyblob NOT NULL default '',
149   oi_user int(5) unsigned NOT NULL default '0',
150   oi_user_text varchar(255) binary NOT NULL default '',
151   oi_timestamp char(14) binary NOT NULL default ''
152 ) TYPE=MyISAM PACK_KEYS=1;
154 DROP TABLE IF EXISTS recentchanges;
155 CREATE TABLE recentchanges (
156   rc_timestamp varchar(14) binary NOT NULL default '',
157   rc_cur_time varchar(14) binary NOT NULL default '',
158   rc_user int(10) unsigned NOT NULL default '0',
159   rc_user_text varchar(255) binary NOT NULL default '',
160   rc_namespace tinyint(3) unsigned NOT NULL default '0',
161   rc_title varchar(255) binary NOT NULL default '',
162   rc_comment varchar(255) binary NOT NULL default '',
163   rc_minor tinyint(3) unsigned NOT NULL default '0',
164   rc_bot tinyint(3) unsigned NOT NULL default '0',
165   rc_new tinyint(3) unsigned NOT NULL default '0',
166   rc_cur_id int(10) unsigned NOT NULL default '0',
167   rc_this_oldid int(10) unsigned NOT NULL default '0',
168   rc_last_oldid int(10) unsigned NOT NULL default '0',
169   rc_type tinyint(3) unsigned NOT NULL default '0',
170   rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0',
171   rc_moved_to_title varchar(255) binary NOT NULL default '',
172 ) TYPE=MyISAM PACK_KEYS=1;
174 DROP TABLE IF EXISTS watchlist;
175 CREATE TABLE watchlist (
176   wl_user int(5) unsigned NOT NULL,
177   wl_namespace tinyint(2) unsigned NOT NULL default '0',
178   wl_title varchar(255) binary NOT NULL default '',
179   UNIQUE KEY (wl_user, wl_namespace, wl_title)
180 ) TYPE=MyISAM PACK_KEYS=1;
182 DROP TABLE IF EXISTS math;
183 CREATE TABLE math (
184   math_inputhash varchar(16) NOT NULL,
185   math_outputhash varchar(16) NOT NULL,
186   math_html_conservativeness tinyint(1) NOT NULL,
187   math_html text,
188   math_mathml text,
189   UNIQUE KEY math_inputhash (math_inputhash)
190 ) TYPE=MyISAM;
193 -- Table searchindex must be MyISAM for fulltext support
195 DROP TABLE IF EXISTS searchindex;
196 CREATE TABLE searchindex (
197   si_page int(8) unsigned NOT NULL,
198   si_title varchar(255) NOT NULL default '',
199   si_text mediumtext NOT NULL default '',
200   UNIQUE KEY (si_page)
201 ) TYPE=MyISAM PACK_KEYS=1;
203 DROP TABLE IF EXISTS interwiki;
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)