2008-07-18 16:03:27 +00:00
|
|
|
-- SQL tables for AbuseFilter extension (Postgres version)
|
|
|
|
|
|
|
|
BEGIN;
|
|
|
|
|
|
|
|
CREATE SEQUENCE abuse_filter_af_id_seq;
|
|
|
|
CREATE TABLE abuse_filter (
|
|
|
|
af_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('abuse_filter_af_id_seq'),
|
|
|
|
af_pattern TEXT NOT NULL,
|
|
|
|
af_user INTEGER NOT NULL,
|
|
|
|
af_user_text TEXT NOT NULL,
|
|
|
|
af_timestamp TIMESTAMPTZ NOT NULL,
|
|
|
|
af_enabled SMALLINT NOT NULL DEFAULT 1,
|
|
|
|
af_comments TEXT,
|
|
|
|
af_public_comments TEXT,
|
|
|
|
af_hidden SMALLINT NOT NULL DEFAULT 0,
|
|
|
|
af_hit_count INTEGER NOT NULL DEFAULT 0,
|
2009-03-23 14:18:35 +00:00
|
|
|
af_throttled SMALLINT NOT NULL DEFAULT 0,
|
|
|
|
af_deleted SMALLINT NOT NULL DEFAULT 0,
|
2009-04-20 22:45:06 +00:00
|
|
|
af_actions TEXT NOT NULL DEFAULT '',
|
2015-02-20 18:25:55 +00:00
|
|
|
af_global SMALLINT NOT NULL DEFAULT 0,
|
|
|
|
af_group TEXT NOT NULL DEFAULT 'default'
|
2008-07-18 16:03:27 +00:00
|
|
|
);
|
|
|
|
CREATE INDEX abuse_filter_user ON abuse_filter(af_user);
|
2015-02-20 18:25:55 +00:00
|
|
|
CREATE INDEX abuse_filter_group_enabled_id ON abuse_filter(af_group,af_enabled,af_id);
|
2008-07-18 16:03:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE abuse_filter_action (
|
|
|
|
afa_filter INTEGER NOT NULL,
|
|
|
|
afa_consequence TEXT NOT NULL,
|
|
|
|
afa_parameters TEXT NOT NULL,
|
|
|
|
PRIMARY KEY (afa_filter,afa_consequence)
|
|
|
|
);
|
|
|
|
CREATE INDEX abuse_filter_action_consequence ON abuse_filter_action(afa_consequence);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE abuse_filter_log_afl_id_seq;
|
|
|
|
CREATE TABLE abuse_filter_log (
|
2018-08-23 13:08:47 +00:00
|
|
|
afl_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('abuse_filter_log_afl_id_seq'),
|
|
|
|
afl_filter TEXT NOT NULL,
|
|
|
|
afl_user INTEGER NOT NULL,
|
|
|
|
afl_user_text TEXT NOT NULL,
|
|
|
|
afl_ip TEXT NOT NULL,
|
|
|
|
afl_action TEXT NOT NULL,
|
|
|
|
afl_actions TEXT NOT NULL,
|
|
|
|
afl_var_dump TEXT NOT NULL,
|
|
|
|
afl_timestamp TIMESTAMPTZ NOT NULL,
|
|
|
|
afl_namespace INTEGER NOT NULL,
|
|
|
|
afl_title TEXT NOT NULL,
|
|
|
|
afl_wiki TEXT NULL,
|
|
|
|
afl_deleted SMALLINT NOT NULL DEFAULT 0,
|
|
|
|
afl_patrolled_by INTEGER NULL,
|
2019-03-28 13:55:37 +00:00
|
|
|
afl_rev_id INTEGER NULL
|
2008-07-18 16:03:27 +00:00
|
|
|
);
|
2018-08-23 13:08:47 +00:00
|
|
|
|
|
|
|
CREATE INDEX abuse_filter_log_filter_timestamp ON abuse_filter_log(afl_filter,afl_timestamp);
|
|
|
|
CREATE INDEX abuse_filter_log_user_timestamp ON abuse_filter_log(afl_user,afl_user_text,afl_timestamp);
|
|
|
|
CREATE INDEX abuse_filter_log_timestamp ON abuse_filter_log(afl_timestamp);
|
|
|
|
CREATE INDEX abuse_filter_log_page_timestamp ON abuse_filter_log(afl_namespace, afl_title, afl_timestamp);
|
|
|
|
CREATE INDEX abuse_filter_log_ip_timestamp ON abuse_filter_log(afl_ip, afl_timestamp);
|
|
|
|
CREATE INDEX abuse_filter_log_rev_id ON abuse_filter_log(afl_rev_id);
|
|
|
|
CREATE INDEX abuse_filter_log_wiki_timestamp ON abuse_filter_log(afl_wiki, afl_timestamp);
|
2008-07-18 16:03:27 +00:00
|
|
|
|
2009-03-23 14:18:35 +00:00
|
|
|
CREATE SEQUENCE abuse_filter_history_afh_id_seq;
|
|
|
|
CREATE TABLE abuse_filter_history (
|
|
|
|
afh_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('abuse_filter_history_afh_id_seq'),
|
|
|
|
afh_filter INTEGER NOT NULL,
|
|
|
|
afh_user INTEGER NOT NULL,
|
|
|
|
afh_user_text TEXT NOT NULL,
|
|
|
|
afh_timestamp TIMESTAMPTZ NOT NULL,
|
|
|
|
afh_pattern TEXT NOT NULL,
|
|
|
|
afh_comments TEXT NOT NULL,
|
|
|
|
afh_flags TEXT NOT NULL,
|
|
|
|
afh_public_comments TEXT NOT NULL,
|
|
|
|
afh_actions TEXT NOT NULL,
|
|
|
|
afh_deleted SMALLINT NOT NULL DEFAULT 0,
|
2015-02-20 18:25:55 +00:00
|
|
|
afh_changed_fields TEXT NOT NULL DEFAULT '',
|
|
|
|
afh_group TEXT NULL
|
2009-03-23 14:18:35 +00:00
|
|
|
);
|
|
|
|
CREATE INDEX abuse_filter_history_filter ON abuse_filter_history(afh_filter);
|
|
|
|
CREATE INDEX abuse_filter_history_user ON abuse_filter_history(afh_user);
|
|
|
|
CREATE INDEX abuse_filter_history_user_text ON abuse_filter_history(afh_user_text);
|
|
|
|
CREATE INDEX abuse_filter_history_timestamp ON abuse_filter_history(afh_timestamp);
|
|
|
|
|
2008-07-18 16:03:27 +00:00
|
|
|
COMMIT;
|
|
|
|
|