mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 15:30:42 +00:00
Fix database schema for PostgreSQL
Bug: T62639 Change-Id: I5ddb781a2971677410f4cb96e5fc5964e53c862a
This commit is contained in:
parent
7877a7a472
commit
db50bef21e
|
@ -35,27 +35,32 @@ CREATE INDEX abuse_filter_action_consequence ON abuse_filter_action(afa_conseque
|
|||
|
||||
CREATE SEQUENCE abuse_filter_log_afl_id_seq;
|
||||
CREATE TABLE abuse_filter_log (
|
||||
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 NULL
|
||||
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,
|
||||
afl_rev_id INTEGER NULL,
|
||||
afl_log_id INTEGER NULL
|
||||
);
|
||||
CREATE INDEX abuse_filter_log_filter ON abuse_filter_log(afl_filter);
|
||||
CREATE INDEX abuse_filter_log_ip ON abuse_filter_log(afl_ip);
|
||||
CREATE INDEX abuse_filter_log_timestamp ON abuse_filter_log(afl_timestamp);
|
||||
CREATE INDEX abuse_filter_log_title ON abuse_filter_log(afl_namespace, afl_title);
|
||||
CREATE INDEX abuse_filter_log_user ON abuse_filter_log(afl_user);
|
||||
CREATE INDEX abuse_filter_log_user_text ON abuse_filter_log(afl_user_text);
|
||||
CREATE INDEX abuse_filter_log_wiki ON abuse_filter_log(afl_wiki);
|
||||
|
||||
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_log_id ON abuse_filter_log(afl_log_id);
|
||||
CREATE INDEX abuse_filter_log_wiki_timestamp ON abuse_filter_log(afl_wiki, afl_timestamp);
|
||||
|
||||
CREATE SEQUENCE abuse_filter_history_afh_id_seq;
|
||||
CREATE TABLE abuse_filter_history (
|
||||
|
|
|
@ -583,18 +583,6 @@ class AbuseFilterHooks {
|
|||
'addPgField', 'abuse_filter', 'af_deleted', 'SMALLINT NOT NULL DEFAULT 0' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter', 'af_global', 'SMALLINT NOT NULL DEFAULT 0' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_wiki', 'TEXT' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_deleted', 'SMALLINT' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT', '' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_ip', "(afl_ip)" ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_wiki', "(afl_wiki)" ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeField', 'abuse_filter_log', 'afl_namespace', "INTEGER", '' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter', 'af_group', "TEXT NOT NULL DEFAULT 'default'" ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
|
@ -603,6 +591,64 @@ class AbuseFilterHooks {
|
|||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_history', 'afh_group', "TEXT" ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_wiki', 'TEXT' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_deleted', 'SMALLINT' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'setDefault', 'abuse_filter_log', 'afl_deleted', '0' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeNullableField', 'abuse_filter_log', 'afl_deleted', 'NOT NULL', true ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_patrolled_by', 'INTEGER' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_rev_id', 'INTEGER' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgField', 'abuse_filter_log', 'afl_log_id', 'INTEGER' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT', '' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'changeField', 'abuse_filter_log', 'afl_namespace', "INTEGER", '' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_filter' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_ip' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_title' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_user' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_user_text' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'dropPgIndex', 'abuse_filter_log', 'abuse_filter_log_wiki' ] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_filter_timestamp',
|
||||
'(afl_filter,afl_timestamp)'
|
||||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_user_timestamp',
|
||||
'(afl_user,afl_user_text,afl_timestamp)'
|
||||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_page_timestamp',
|
||||
'(afl_namespace,afl_title,afl_timestamp)'
|
||||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_ip_timestamp',
|
||||
'(afl_ip, afl_timestamp)'
|
||||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_rev_id',
|
||||
'(afl_rev_id)'
|
||||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_log_id',
|
||||
'(afl_log_id)'
|
||||
] );
|
||||
$updater->addExtensionUpdate( [
|
||||
'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_wiki_timestamp',
|
||||
'(afl_wiki,afl_timestamp)'
|
||||
] );
|
||||
}
|
||||
|
||||
$updater->addExtensionUpdate( [ [ __CLASS__, 'createAbuseFilterUser' ] ] );
|
||||
|
|
Loading…
Reference in a new issue