CREATE INDEX &mw_prefix.archive_i01 ON &mw_prefix.archive (ar_namespace,ar_title,ar_timestamp);
CREATE INDEX &mw_prefix.archive_i02 ON &mw_prefix.archive (ar_user_text,ar_timestamp);
CREATE INDEX &mw_prefix.ar_actor_timestamp ON &mw_prefix.archive (ar_actor,ar_timestamp);
-CREATE INDEX &mw_prefix.archive_i03 ON &mw_prefix.archive (ar_rev_id);
+CREATE UNIQUE INDEX &mw_prefix.archive_i04 ON &mw_prefix.archive (ar_rev_id);
/*$mw$*/
CREATE TRIGGER &mw_prefix.archive_seq_trg BEFORE INSERT ON &mw_prefix.archive
FOR EACH ROW WHEN (new.ar_id IS NULL)
END;
/*$mw$*/
+-- Table defining tag names for IDs. Also stores hit counts to avoid expensive queries on change_tag
+CREATE SEQUENCE change_tag_def_ctd_id_seq;
+CREATE TABLE &mw_prefix.change_tag_def (
+ -- Numerical ID of the tag (ct_tag_id refers to this)
+ ctd_id NUMBER NOT NULL,
+ -- Symbolic name of the tag (what would previously be put in ct_tag)
+ ctd_name VARCHAR2(255) NOT NULL,
+ -- Whether this tag was defined manually by a privileged user using Special:Tags
+ ctd_user_defined CHAR(1) DEFAULT '0' NOT NULL,
+ -- Number of times this tag was used
+ ctd_count NUMBER NOT NULL DEFAULT 0
+);
+
+ALTER TABLE &mw_prefix.change_tag_def ADD CONSTRAINT &mw_prefix.change_tag_def_pk PRIMARY KEY (ctd_id);
+CREATE UNIQUE INDEX &mw_prefix.ctd_name ON &mw_prefix.change_tag_def (ctd_name);
+CREATE INDEX &mw_prefix.ctd_count ON &mw_prefix.change_tag_def (ctd_count);
+CREATE INDEX &mw_prefix.ctd_user_defined ON &mw_prefix.change_tag_def (ctd_user_defined);
+
+/*$mw$*/
+CREATE TRIGGER &mw_prefix.change_tag_def_seq_trg BEFORE INSERT ON &mw_prefix.change_tag_def
+ FOR EACH ROW WHEN (new.ctd_id IS NULL)
+BEGIN
+ &mw_prefix.lastval_pkg.setLastval(change_tag_def_ctd_id_seq.nextval, :new.ctd_id);
+END;
+/*$mw$*/
+
CREATE TABLE &mw_prefix.langlinks (
ll_from NUMBER NOT NULL,
ll_lang VARCHAR2(20),
ipb_user NUMBER DEFAULT 0 NOT NULL,
ipb_by NUMBER DEFAULT 0 NOT NULL,
ipb_by_text VARCHAR2(255) NULL,
- ipb_by_actor NUMBER DEFUALT 0 NOT NULL,
+ ipb_by_actor NUMBER DEFAULT 0 NOT NULL,
ipb_reason VARCHAR2(255) NULL,
ipb_reason_id NUMBER DEFAULT 0 NOT NULL,
ipb_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
ct_log_id NUMBER NULL,
ct_rev_id NUMBER NULL,
ct_tag VARCHAR2(255) NOT NULL,
- ct_params BLOB NULL
+ ct_params BLOB NULL,
+ ct_tag_id NUMBER NULL,
);
ALTER TABLE &mw_prefix.change_tag ADD CONSTRAINT &mw_prefix.change_tag_pk PRIMARY KEY (ct_id);
CREATE UNIQUE INDEX &mw_prefix.change_tag_u01 ON &mw_prefix.change_tag (ct_rc_id,ct_tag);
CREATE UNIQUE INDEX &mw_prefix.change_tag_u02 ON &mw_prefix.change_tag (ct_log_id,ct_tag);
CREATE UNIQUE INDEX &mw_prefix.change_tag_u03 ON &mw_prefix.change_tag (ct_rev_id,ct_tag);
CREATE INDEX &mw_prefix.change_tag_i01 ON &mw_prefix.change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
+CREATE INDEX &mw_prefix.change_tag_i02 ON &mw_prefix.change_tag (ct_tag_id,ct_rc_id,ct_rev_id,ct_log_id);
CREATE TABLE &mw_prefix.tag_summary (
ts_id NUMBER NOT NULL,