Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql |
— | — | @@ -15,14 +15,14 @@ |
16 | 16 | fp_stable integer unsigned NOT NULL, |
17 | 17 | -- The highest quality of the page's reviewed revisions. |
18 | 18 | -- Note that this may not be set to display by default though. |
19 | | - fp_quality tinyint(1) default NULL, |
20 | | - |
21 | | - PRIMARY KEY (fp_page_id), |
22 | | - INDEX fp_reviewed_page (fp_reviewed,fp_page_id), |
23 | | - INDEX fp_quality_page (fp_quality,fp_page_id), |
24 | | - INDEX fp_pending_since (fp_pending_since) |
| 19 | + fp_quality tinyint(1) default NULL |
25 | 20 | ) /*$wgDBTableOptions*/; |
26 | 21 | |
| 22 | +CREATE UNIQUE INDEX /*i*/fp_page_id ON /*_*/flaggedpages (fp_page_id); |
| 23 | +CREATE INDEX /*i*/fp_reviewed_page ON /*_*/flaggedpages (fp_reviewed,fp_page_id); |
| 24 | +CREATE INDEX /*i*/fp_quality_page ON /*_*/flaggedpages (fp_quality,fp_page_id); |
| 25 | +CREATE INDEX /*i*/fp_pending_since ON /*_*/flaggedpages (fp_pending_since); |
| 26 | + |
27 | 27 | -- Add tracking table for edits needing review (for all levels) |
28 | 28 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpage_pending ( |
29 | 29 | -- Foreign key to page.page_id |
— | — | @@ -32,12 +32,12 @@ |
33 | 33 | -- The last rev ID with this quality |
34 | 34 | fpp_rev_id integer unsigned NOT NULL, |
35 | 35 | -- Time of the first edit after the last revision reviewed to this level |
36 | | - fpp_pending_since char(14) NOT NULL, |
37 | | - |
38 | | - PRIMARY KEY (fpp_page_id,fpp_quality), |
39 | | - INDEX fpp_quality_pending (fpp_quality,fpp_pending_since) |
| 36 | + fpp_pending_since char(14) NOT NULL |
40 | 37 | ) /*$wgDBTableOptions*/; |
41 | 38 | |
| 39 | +CREATE UNIQUE INDEX /*i*/fpp_page_qal ON /*_*/flaggedpage_pending (fpp_page_id,fpp_quality); |
| 40 | +CREATE INDEX /*i*/fpp_quality_pending ON /*_*/flaggedpage_pending (fpp_quality,fpp_pending_since); |
| 41 | + |
42 | 42 | -- This stores all of our revision reviews; it is the main table |
43 | 43 | -- The template/file version data is stored in the next two tables |
44 | 44 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs ( |
— | — | @@ -68,13 +68,13 @@ |
69 | 69 | -- Timestamp of file (when uploaded) (NULL if n/a) |
70 | 70 | fr_img_timestamp char(14) NULL default NULL, |
71 | 71 | -- Statistically unique SHA-1 key (NULL if n/a) |
72 | | - fr_img_sha1 varbinary(32) NULL default NULL, |
73 | | - |
74 | | - PRIMARY KEY (fr_page_id,fr_rev_id), |
75 | | - INDEX fr_img_sha1 (fr_img_sha1), |
76 | | - INDEX page_qal_rev (fr_page_id,fr_quality,fr_rev_id) |
| 72 | + fr_img_sha1 varbinary(32) NULL default NULL |
77 | 73 | ) /*$wgDBTableOptions*/; |
78 | 74 | |
| 75 | +CREATE UNIQUE INDEX /*i*/fr_page_rev ON /*_*/flaggedrevs (fr_page_id,fr_rev_id); |
| 76 | +CREATE INDEX /*i*/fr_img_sha1 ON /*_*/flaggedrevs (fr_img_sha1); |
| 77 | +CREATE INDEX /*i*/page_qal_rev ON /*_*/flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
| 78 | + |
79 | 79 | -- This stores all of our transclusion revision pointers |
80 | 80 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedtemplates ( |
81 | 81 | ft_rev_id integer unsigned NOT NULL, |
— | — | @@ -82,11 +82,11 @@ |
83 | 83 | ft_namespace int NOT NULL default '0', |
84 | 84 | ft_title varchar(255) binary NOT NULL default '', |
85 | 85 | -- Revisions ID used when reviewed |
86 | | - ft_tmp_rev_id integer unsigned NULL, |
87 | | - |
88 | | - PRIMARY KEY (ft_rev_id,ft_namespace,ft_title) |
| 86 | + ft_tmp_rev_id integer unsigned NULL |
89 | 87 | ) /*$wgDBTableOptions*/; |
90 | 88 | |
| 89 | +CREATE UNIQUE INDEX /*i*/ft_rev_namespace_title ON /*_*/flaggedtemplates (ft_rev_id,ft_namespace,ft_title); |
| 90 | + |
91 | 91 | -- This stores all of our image revision pointers |
92 | 92 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedimages ( |
93 | 93 | fi_rev_id integer unsigned NOT NULL, |
— | — | @@ -95,11 +95,11 @@ |
96 | 96 | -- Timestamp of image used when reviewed |
97 | 97 | fi_img_timestamp char(14) NOT NULL default '', |
98 | 98 | -- Statistically unique SHA-1 key |
99 | | - fi_img_sha1 varbinary(32) NOT NULL default '', |
100 | | - |
101 | | - PRIMARY KEY (fi_rev_id,fi_name) |
| 99 | + fi_img_sha1 varbinary(32) NOT NULL default '' |
102 | 100 | ) /*$wgDBTableOptions*/; |
103 | 101 | |
| 102 | +CREATE UNIQUE INDEX /*i*/fi_rev_name ON /*_*/flaggedimages (fi_rev_id,fi_name); |
| 103 | + |
104 | 104 | -- This stores settings on how to select the stable/default revision |
105 | 105 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpage_config ( |
106 | 106 | -- Foreign key to page.page_id |
— | — | @@ -114,28 +114,27 @@ |
115 | 115 | -- The protection level (Sysop, etc) for autoreview |
116 | 116 | fpc_level varbinary(60) NULL, |
117 | 117 | -- Field for time-limited settings |
118 | | - fpc_expiry varbinary(14) NOT NULL default 'infinity', |
119 | | - |
120 | | - PRIMARY KEY (fpc_page_id), |
121 | | - INDEX (fpc_expiry) |
| 118 | + fpc_expiry varbinary(14) NOT NULL default 'infinity' |
122 | 119 | ) /*$wgDBTableOptions*/; |
123 | 120 | |
| 121 | +CREATE UNIQUE INDEX /*i*/fpc_page_id ON /*_*/flaggedpage_config (fpc_page_id); |
| 122 | +CREATE INDEX /*i*/fpc_expiry ON /*_*/flaggedpage_config (fpc_expiry); |
| 123 | + |
124 | 124 | -- Track includes/links only in stable versions |
125 | 125 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs_tracking ( |
126 | 126 | ftr_from integer unsigned NOT NULL default '0', |
127 | 127 | ftr_namespace int NOT NULL default '0', |
128 | | - ftr_title varchar(255) binary NOT NULL default '', |
129 | | - |
130 | | - PRIMARY KEY (ftr_from,ftr_namespace,ftr_title), |
131 | | - INDEX namespace_title_from (ftr_namespace,ftr_title,ftr_from) |
| 128 | + ftr_title varchar(255) binary NOT NULL default '' |
132 | 129 | ) /*$wgDBTableOptions*/; |
133 | 130 | |
| 131 | +CREATE UNIQUE INDEX /*i*/from_namespace_title ON /*_*/flaggedrevs_tracking (ftr_from,ftr_namespace,ftr_title); |
| 132 | +CREATE INDEX /*i*/namespace_title_from ON /*_*/flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from); |
| 133 | + |
134 | 134 | -- This stores user demotions and stats |
135 | 135 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs_promote ( |
136 | 136 | -- Foreign key to user.user_id |
137 | 137 | frp_user_id integer unsigned NOT NULL, |
138 | | - frp_user_params mediumblob NOT NULL, |
139 | | - |
140 | | - PRIMARY KEY (frp_user_id) |
| 138 | + frp_user_params mediumblob NOT NULL |
141 | 139 | ) /*$wgDBTableOptions*/; |
142 | 140 | |
| 141 | +CREATE UNIQUE INDEX /*i*/frp_user_id ON /*_*/flaggedrevs_promote (frp_user_id); |