Rules to allow deletion from archive[2]
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Wed, 7 Feb 2007 18:13:00 +0000 (18:13 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Wed, 7 Feb 2007 18:13:00 +0000 (18:13 +0000)
maintenance/postgres/tables.sql
maintenance/updaters.inc

index 0bea5f8..4dca3b1 100644 (file)
@@ -150,6 +150,12 @@ DO INSTEAD INSERT INTO archive2 VALUES (
   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,
index 54ae702..454f082 100644 (file)
@@ -1207,7 +1207,7 @@ ALTER TABLE page_restrictions ADD CONSTRAINT page_restrictions_pk PRIMARY KEY (p
 -- 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, 
@@ -1215,6 +1215,14 @@ DO INSTEAD INSERT INTO archive2 VALUES (
   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');