Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | -- Add page tracking table for flagged revisions |
8 | 8 | CREATE TABLE IF NOT EXISTS /*_*/flaggedpages ( |
9 | 9 | -- Foreign key to page.page_id |
10 | | - fp_page_id integer unsigned NOT NULL, |
| 10 | + fp_page_id integer unsigned NOT NULL PRIMARY KEY, |
11 | 11 | -- Is the stable version synced? |
12 | 12 | fp_reviewed bool NOT NULL default '0', |
13 | 13 | -- When (or NULL) the first edit after the stable version was made |
— | — | @@ -18,7 +18,6 @@ |
19 | 19 | fp_quality tinyint(1) default NULL |
20 | 20 | ) /*$wgDBTableOptions*/; |
21 | 21 | |
22 | | -CREATE UNIQUE INDEX /*i*/fp_page_id ON /*_*/flaggedpages (fp_page_id); |
23 | 22 | CREATE INDEX /*i*/fp_reviewed_page ON /*_*/flaggedpages (fp_reviewed,fp_page_id); |
24 | 23 | CREATE INDEX /*i*/fp_quality_page ON /*_*/flaggedpages (fp_quality,fp_page_id); |
25 | 24 | CREATE INDEX /*i*/fp_pending_since ON /*_*/flaggedpages (fp_pending_since); |
— | — | @@ -32,10 +31,11 @@ |
33 | 32 | -- The last rev ID with this quality |
34 | 33 | fpp_rev_id integer unsigned NOT NULL, |
35 | 34 | -- Time of the first edit after the last revision reviewed to this level |
36 | | - fpp_pending_since char(14) NOT NULL |
| 35 | + fpp_pending_since char(14) NOT NULL, |
| 36 | + |
| 37 | + PRIMARY KEY (fpp_page_id,fpp_quality) |
37 | 38 | ) /*$wgDBTableOptions*/; |
38 | 39 | |
39 | | -CREATE UNIQUE INDEX /*i*/fpp_page_qal ON /*_*/flaggedpage_pending (fpp_page_id,fpp_quality); |
40 | 40 | CREATE INDEX /*i*/fpp_quality_pending ON /*_*/flaggedpage_pending (fpp_quality,fpp_pending_since); |
41 | 41 | |
42 | 42 | -- This stores all of our revision reviews; it is the main table |
— | — | @@ -68,10 +68,11 @@ |
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 |
| 72 | + fr_img_sha1 varbinary(32) NULL default NULL, |
| 73 | + |
| 74 | + PRIMARY KEY (fr_page_id,fr_rev_id) |
73 | 75 | ) /*$wgDBTableOptions*/; |
74 | 76 | |
75 | | -CREATE UNIQUE INDEX /*i*/fr_page_rev ON /*_*/flaggedrevs (fr_page_id,fr_rev_id); |
76 | 77 | CREATE INDEX /*i*/fr_img_sha1 ON /*_*/flaggedrevs (fr_img_sha1); |
77 | 78 | CREATE INDEX /*i*/page_qal_rev ON /*_*/flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
78 | 79 | |
— | — | @@ -82,11 +83,11 @@ |
83 | 84 | ft_namespace int NOT NULL default '0', |
84 | 85 | ft_title varchar(255) binary NOT NULL default '', |
85 | 86 | -- Revisions ID used when reviewed |
86 | | - ft_tmp_rev_id integer unsigned NULL |
| 87 | + ft_tmp_rev_id integer unsigned NULL, |
| 88 | + |
| 89 | + PRIMARY KEY (ft_rev_id,ft_namespace,ft_title) |
87 | 90 | ) /*$wgDBTableOptions*/; |
88 | 91 | |
89 | | -CREATE UNIQUE INDEX /*i*/ft_rev_namespace_title ON /*_*/flaggedtemplates (ft_rev_id,ft_namespace,ft_title); |
90 | | - |
91 | 92 | -- This stores all of our image revision pointers |
92 | 93 | CREATE TABLE IF NOT EXISTS /*_*/flaggedimages ( |
93 | 94 | fi_rev_id integer unsigned NOT NULL, |
— | — | @@ -95,15 +96,15 @@ |
96 | 97 | -- Timestamp of image used when reviewed |
97 | 98 | fi_img_timestamp char(14) NOT NULL default '', |
98 | 99 | -- Statistically unique SHA-1 key |
99 | | - fi_img_sha1 varbinary(32) NOT NULL default '' |
| 100 | + fi_img_sha1 varbinary(32) NOT NULL default '', |
| 101 | + |
| 102 | + PRIMARY KEY (fi_rev_id,fi_name) |
100 | 103 | ) /*$wgDBTableOptions*/; |
101 | 104 | |
102 | | -CREATE UNIQUE INDEX /*i*/fi_rev_name ON /*_*/flaggedimages (fi_rev_id,fi_name); |
103 | | - |
104 | 105 | -- This stores settings on how to select the stable/default revision |
105 | 106 | CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_config ( |
106 | 107 | -- Foreign key to page.page_id |
107 | | - fpc_page_id integer unsigned NOT NULL, |
| 108 | + fpc_page_id integer unsigned NOT NULL PRIMARY KEY, |
108 | 109 | -- Integers to represent what to show by default: |
109 | 110 | -- 0: quality -> stable |
110 | 111 | -- 1: latest reviewed |
— | — | @@ -117,7 +118,6 @@ |
118 | 119 | fpc_expiry varbinary(14) NOT NULL default 'infinity' |
119 | 120 | ) /*$wgDBTableOptions*/; |
120 | 121 | |
121 | | -CREATE UNIQUE INDEX /*i*/fpc_page_id ON /*_*/flaggedpage_config (fpc_page_id); |
122 | 122 | CREATE INDEX /*i*/fpc_expiry ON /*_*/flaggedpage_config (fpc_expiry); |
123 | 123 | |
124 | 124 | -- Track includes/links only in stable versions |
— | — | @@ -133,8 +133,6 @@ |
134 | 134 | -- This stores user demotions and stats |
135 | 135 | CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_promote ( |
136 | 136 | -- Foreign key to user.user_id |
137 | | - frp_user_id integer unsigned NOT NULL, |
| 137 | + frp_user_id integer unsigned NOT NULL PRIMARY KEY, |
138 | 138 | frp_user_params mediumblob NOT NULL |
139 | 139 | ) /*$wgDBTableOptions*/; |
140 | | - |
141 | | -CREATE UNIQUE INDEX /*i*/frp_user_id ON /*_*/flaggedrevs_promote (frp_user_id); |