NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id
);
+CREATE RULE archive_delete AS ON DELETE TO archive
+DO INSTEAD DELETE FROM archive2 a2 WHERE
+ a2.ar_title = OLD.ar_title AND
+ a2.ar_namespace = OLD.ar_namespace AND
+ a2.ar_rev_id = OLD.ar_rev_id;
+
CREATE TABLE redirect (
rd_from INTEGER NOT NULL REFERENCES page(page_id) ON DELETE CASCADE,
-- Add a new index to help with full-text searches
CREATE INDEX rev_text_id_idx ON revision (rev_text_id);
--- Fix the archive rule
+-- Fix the archive rule ar_timestamp field
CREATE OR REPLACE RULE archive_insert AS ON INSERT TO archive
DO INSTEAD INSERT INTO archive2 VALUES (
NEW.ar_namespace, NEW.ar_title, NEW.ar_text, NEW.ar_comment, NEW.ar_user, NEW.ar_user_text,
NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id
);
+-- Allow deletion of archive rows
+CREATE RULE archive_delete AS ON DELETE TO archive
+DO INSTEAD DELETE FROM archive2 a2 WHERE
+ a2.ar_title = OLD.ar_title AND
+ a2.ar_namespace = OLD.ar_namespace AND
+ a2.ar_rev_id = OLD.ar_rev_id;
+
+
-- Note this upgrade
INSERT INTO mediawiki_version (type,mw_version,notes)
VALUES ('Upgrade','MWVERSION','Upgrade from older pre 1.10 version THISVERSION aka SVERSION');