This is description of the work involved in adding revision columns for pages rather than the current approach of computing them.
Initial research complete. API changes should be made before upgrade script is pushed out.
alter table `pages` add column `page_revision` int UNSIGNED NOT NULL;
update `pages` p
set p.page_revision =
( SELECT count(*) + 1
FROM `old` o
WHERE o.old_title = p.page_title
AND o.old_namespace = p.page_namespace
);
alter table `old` add column `old_revision` int UNSIGNED NOT NULL;
alter table `old` add unique `ns_title_rev` (`old_namespace`, `old_title`, `old_revision`);
update old c
join (
select a.old_id, a.old_title, a.old_namespace, a.old_timestamp,
( select count(*)
from old b
where b.old_title = a.old_title
and b.old_namespace = a.old_namespace
and b.old_id <= a.old_id
) as rev
from old a) d
on c.old_id = d.old_id
set c.old_revision = d.rev;
alter table `archive` add column `ar_revision` int UNSIGNED NOT NULL;
update archive c
join (
select a.ar_id, a.ar_title, a.ar_namespace, a.ar_timestamp, a.ar_last_page_id,
( select count(*) + 1
from archive b
where b.ar_title = a.ar_title
and b.ar_namespace = a.ar_namespace
and b.ar_last_page_id = a.ar_last_page_id
and ((b.ar_timestamp < a.ar_timestamp) OR (b.ar_timestamp = a.ar_timestamp AND b.ar_id < a.ar_id))
) as rev
from archive a) d
on c.ar_id = d.ar_id
set c.ar_revision = d.rev;
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by