Index: trunk/phase3/maintenance/archives/patch-user_properties.sql |
— | — | @@ -1,8 +1,20 @@ |
2 | | - |
| 2 | +-- |
| 3 | +-- User preferences and perhaps other fun stuff. :) |
| 4 | +-- Replaces the old user.user_options blob, with a couple nice properties: |
| 5 | +-- |
| 6 | +-- 1) We only store non-default settings, so changes to the defauls |
| 7 | +-- are now reflected for everybody, not just new accounts. |
| 8 | +-- 2) We can more easily do bulk lookups, statistics, or modifications of |
| 9 | +-- saved options since it's a sane table structure. |
| 10 | +-- |
3 | 11 | CREATE TABLE /*_*/user_properties( |
4 | | - up_user bigint not null, |
| 12 | + -- Foreign key to user.user_id |
| 13 | + up_user int not null, |
| 14 | + |
| 15 | + -- Name of the option being saved. This is indexed for bulk lookup. |
5 | 16 | up_property varbinary(32) not null, |
| 17 | + |
| 18 | + -- Property value as a string. |
6 | 19 | up_value blob |
7 | 20 | ) /*$wgDBTableOptions*/; |
8 | 21 | |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -86,7 +86,8 @@ |
87 | 87 | |
88 | 88 | -- Newline-separated list of name=value defining the user |
89 | 89 | -- preferences |
90 | | - -- Now obsolete in favour of user_properties table. |
| 90 | + -- Now obsolete in favour of user_properties table; |
| 91 | + -- old values will be migrated from here transparently. |
91 | 92 | user_options blob NOT NULL, |
92 | 93 | |
93 | 94 | -- This is a timestamp which is updated when a user |
— | — | @@ -161,8 +162,10 @@ |
162 | 163 | CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group); |
163 | 164 | |
164 | 165 | |
| 166 | +-- |
165 | 167 | -- Stores notifications of user talk page changes, for the display |
166 | 168 | -- of the "you have new messages" box |
| 169 | +-- |
167 | 170 | CREATE TABLE /*_*/user_newtalk ( |
168 | 171 | -- Key to user.user_id |
169 | 172 | user_id int NOT NULL default 0, |
— | — | @@ -180,6 +183,29 @@ |
181 | 184 | |
182 | 185 | |
183 | 186 | -- |
| 187 | +-- User preferences and perhaps other fun stuff. :) |
| 188 | +-- Replaces the old user.user_options blob, with a couple nice properties: |
| 189 | +-- |
| 190 | +-- 1) We only store non-default settings, so changes to the defauls |
| 191 | +-- are now reflected for everybody, not just new accounts. |
| 192 | +-- 2) We can more easily do bulk lookups, statistics, or modifications of |
| 193 | +-- saved options since it's a sane table structure. |
| 194 | +-- |
| 195 | +CREATE TABLE /*_*/user_properties( |
| 196 | + -- Foreign key to user.user_id |
| 197 | + up_user int not null, |
| 198 | + |
| 199 | + -- Name of the option being saved. This is indexed for bulk lookup. |
| 200 | + up_property varbinary(32) not null, |
| 201 | + |
| 202 | + -- Property value as a string. |
| 203 | + up_value blob |
| 204 | +) /*$wgDBTableOptions*/; |
| 205 | + |
| 206 | +CREATE UNIQUE INDEX /*i*/user_properties_user_property on /*_*/user_properties (up_user,up_property); |
| 207 | +CREATE INDEX /*i*/user_properties_property on /*_*/user_properties (up_property); |
| 208 | + |
| 209 | +-- |
184 | 210 | -- Core of the wiki: each page has an entry here which identifies |
185 | 211 | -- it by title and contains some essential metadata. |
186 | 212 | -- |
— | — | @@ -1252,7 +1278,8 @@ |
1253 | 1279 | CREATE INDEX /*i*/change_tag_tag_id ON /*_*/change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id); |
1254 | 1280 | |
1255 | 1281 | |
| 1282 | +-- Rollup table to pull a LIST of tags simply without ugly GROUP_CONCAT |
| 1283 | +-- that only works on MySQL 4.1+ |
1256 | 1284 | CREATE TABLE /*_*/tag_summary ( |
1257 | 1285 | ts_rc_id int NULL, |
1258 | 1286 | ts_log_id int NULL, |
— | — | @@ -1269,13 +1296,4 @@ |
1270 | 1297 | vt_tag varchar(255) NOT NULL PRIMARY KEY |
1271 | 1298 | ) /*$wgDBTableOptions*/; |
1272 | 1299 | |
1273 | | -CREATE TABLE /*_*/user_properties( |
1274 | | - up_user int not null, |
1275 | | - up_property varbinary(32) not null, |
1276 | | - up_value blob |
1277 | | -) /*$wgDBTableOptions*/; |
1278 | | - |
1279 | | -CREATE UNIQUE INDEX /*i*/user_properties_user_property on /*_*/user_properties (up_user,up_property); |
1280 | | -CREATE INDEX /*i*/user_properties_property on /*_*/user_properties (up_property); |
1281 | | - |
1282 | 1300 | -- vim: sw=2 sts=2 et |