The existing field to differentiate between kinds of recentchanges rows is the rc_type field. We want to allow extensions to insert their own custom data into recentchanges, but we have learned via the NS_* series of constants that requiring extensions to "register" a specific number is very error prone. The solution, which this commit implements the first phase of, is to utilize a new 16 byte string field rc_source. Within that field change types will be prefixed strings such as 'mw.edit' and 'mw.new'. This commit adds the new field and begins populating it with data. At some point in the future the rc_type field will be dropped. While WMF wiki's will simply wait out the 30 day recentchanges history, other wiki's have the option of letting update.php populate rc_source, or manually applying the db change and utilizing the PopulateRecentChangeSource maintenance script. Change-Id: Iaddd6c446373a68d31586ed54346db7d04e13b2c
16 lines
591 B
SQL
16 lines
591 B
SQL
-- first step of migrating recentchanges rc_type to rc_source
|
|
ALTER TABLE /*$wgDBprefix*/recentchanges
|
|
ADD rc_source varbinary(16) NOT NULL default '';
|
|
|
|
-- Populate rc_source field with the data from rc_type
|
|
-- Large wiki's might prefer the PopulateRecentChangeSource maintenance
|
|
-- script to batch updates into groups rather than all at once.
|
|
UPDATE /*$wgDBprefix*/recentchanges
|
|
SET rc_source = CASE
|
|
WHEN rc_type = 0 THEN 'mw.edit'
|
|
WHEN rc_type = 1 THEN 'mw.new'
|
|
WHEN rc_type = 3 THEN 'mw.log'
|
|
WHEN rc_type = 5 THEN 'mw.external'
|
|
ELSE ''
|
|
END
|
|
WHERE rc_source = '';
|