[ 'runMaintenance', PopulateChangeTagDef::class, 'maintenance/populateChangeTagDef.php' ],
[ 'addIndex', 'change_tag', 'change_tag_rc_tag_id',
'patch-change_tag-change_tag_rc_tag_id.sql' ],
+ [ 'addField', 'ipblocks', 'ipb_sitewide', 'patch-ipb_sitewide.sql' ],
+ [ 'addTable', 'ipblocks_restrictions', 'patch-ipblocks_restrictions-table.sql' ],
];
}
[ 'runMaintenance', PopulateChangeTagDef::class, 'maintenance/populateChangeTagDef.php' ],
[ 'addIndex', 'change_tag', 'change_tag_rc_tag_id',
'patch-change_tag-change_tag_rc_tag_id.sql' ],
+ [ 'addField', 'ipblocks', 'ipb_sitewide', 'patch-ipb_sitewide.sql' ],
+ [ 'addTable', 'ipblocks_restrictions', 'patch-ipblocks_restrictions-table.sql' ],
];
}
[ 'runMaintenance', PopulateChangeTagDef::class, 'maintenance/populateChangeTagDef.php' ],
[ 'addIndex', 'change_tag', 'change_tag_i03',
'patch-change_tag-change_tag_rc_tag_id.sql' ],
+ [ 'addField', 'ipblocks', 'ipb_sitewide', 'patch-ipb_sitewide.sql' ],
+ [ 'addTable', 'ipblocks_restrictions', 'patch-ipblocks_restrictions-table.sql' ],
// KEEP THIS AT THE BOTTOM!!
[ 'doRebuildDuplicateFunction' ],
[ 'runMaintenance', PopulateChangeTagDef::class, 'maintenance/populateChangeTagDef.php' ],
[ 'addIndex', 'change_tag', 'change_tag_rc_tag_id',
'patch-change_tag-change_tag_rc_tag_id.sql' ],
+ [ 'addPgField', 'ipblocks', 'ipb_sitewide', 'SMALLINT NOT NULL DEFAULT 1' ],
+ [ 'addTable', 'ipblocks_restrictions', 'patch-ipblocks_restrictions-table.sql' ],
];
}
[ 'runMaintenance', PopulateChangeTagDef::class, 'maintenance/populateChangeTagDef.php' ],
[ 'addIndex', 'change_tag', 'change_tag_rc_tag_id',
'patch-change_tag-change_tag_rc_tag_id.sql' ],
+ [ 'addField', 'ipblocks', 'ipb_sitewide', 'patch-ipb_sitewide.sql' ],
+ [ 'addTable', 'ipblocks_restrictions', 'patch-ipblocks_restrictions-table.sql' ],
];
}
--- /dev/null
+-- Adding ipb_sitewide for blocks
+ALTER TABLE /*$wgDBprefix*/ipblocks
+ ADD ipb_sitewide bool NOT NULL default 1;
--- /dev/null
+-- For partial block restrictions --
+
+CREATE TABLE /*_*/ipblocks_restrictions (
+ ir_ipb_id int NOT NULL,
+ ir_type tinyint NOT NULL,
+ ir_value int NOT NULL,
+ PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
+) /*$wgDBTableOptions*/;
+
+-- Index to query restrictions by the page or namespace.
+CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
--- /dev/null
+-- Adding ipb_sitewide for blocks
+ALTER TABLE /*$wgDBprefix*/ipblocks
+ ADD ipb_sitewide bit NOT NULL CONSTRAINT DF_ipb_sitewide DEFAULT 1;
--- /dev/null
+-- For partial block restrictions --
+
+CREATE TABLE /*_*/ipblocks_restrictions (
+ ir_ipb_id int NOT NULL CONSTRAINT FK_ir_ipb_id FOREIGN KEY REFERENCES /*_*/ipblocks(ipb_id) ON DELETE CASCADE,
+ ir_type tinyint NOT NULL,
+ ir_value int NOT NULL,
+ CONSTRAINT PK_ipblocks_restrictions PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
+) /*$wgDBTableOptions*/;
+
+-- Index to query restrictions by the page or namespace.
+CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
-- Autoblocks set this to the original block
-- so that the original block being deleted also
-- deletes the autoblocks
- ipb_parent_block_id int default NULL REFERENCES /*_*/ipblocks(ipb_id)
+ ipb_parent_block_id int default NULL REFERENCES /*_*/ipblocks(ipb_id),
+ -- Block user from editing any page on the site (other than their own user
+ -- talk page).
+ ipb_sitewide bit NOT NULL CONSTRAINT DF_ipb_sitewide DEFAULT 1
);
-- Unique index to support "user already blocked" messages
CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
+--
+-- Partial Block Restrictions
+--
+CREATE TABLE /*_*/ipblocks_restrictions (
+
+ -- The ipb_id from ipblocks
+ ir_ipb_id int NOT NULL CONSTRAINT FK_ir_ipb_id FOREIGN KEY REFERENCES /*_*/ipblocks(ipb_id) ON DELETE CASCADE,
+
+ -- The restriction type id.
+ ir_type tinyint NOT NULL,
+
+ -- The restriction id that corrposponds to the type. Typically a Page ID or a
+ -- Namespace ID.
+ ir_value int NOT NULL,
+
+ CONSTRAINT PK_ipblocks_restrictions PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
+) /*$wgDBTableOptions*/;
+
+-- Index to query restrictions by the page or namespace.
+CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
--
-- Uploaded images and other files.
--- /dev/null
+-- Adding ipb_sitewide for blocks
+ALTER TABLE &mw_prefix.ipblocks
+ ADD ipb_sitewide CHAR(1) DEFAULT '1' NOT NULL;
--- /dev/null
+-- For partial block restrictions --
+
+CREATE TABLE &mw_prefix.ipblocks_restrictions (
+ ir_ipb_id NUMBER NOT NULL,
+ ir_type NUMBER NOT NULL,
+ ir_value NUMBER NOT NULL
+);
+
+ALTER TABLE &mw_prefix.ipblocks_restrictions ADD CONSTRAINT ipblocks_restrictions_pk PRIMARY KEY (ir_ipb_id, ir_type, ir_value);
+
+-- Index to query restrictions by the page or namespace.
+CREATE INDEX &mw_prefix.ir_type_value ON &mw_prefix.ipblocks_restrictions (ir_type, ir_value);
ipb_block_email CHAR(1) DEFAULT '0' NOT NULL,
ipb_allow_usertalk CHAR(1) DEFAULT '0' NOT NULL,
ipb_parent_block_id NUMBER DEFAULT NULL
+ ipb_sitewide CHAR(1) DEFAULT '1' NOT NULL
);
ALTER TABLE &mw_prefix.ipblocks ADD CONSTRAINT &mw_prefix.ipblocks_pk PRIMARY KEY (ipb_id);
ALTER TABLE &mw_prefix.ipblocks ADD CONSTRAINT &mw_prefix.ipblocks_fk1 FOREIGN KEY (ipb_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
END;
/*$mw$*/
+CREATE TABLE &mw_prefix.ipblocks_restrictions (
+ ir_ipb_id NUMBER NOT NULL,
+ ir_type NUMBER NOT NULL,
+ ir_value NUMBER NOT NULL
+);
+ALTER TABLE &mw_prefix.ipblocks_restrictions ADD CONSTRAINT ipblocks_restrictions_pk PRIMARY KEY (ir_ipb_id, ir_type, ir_value);
+CREATE INDEX &mw_prefix.ir_type_value ON &mw_prefix.ipblocks_restrictions (ir_type, ir_value);
+
CREATE TABLE &mw_prefix.image (
img_name VARCHAR2(255) NOT NULL,
img_size NUMBER DEFAULT 0 NOT NULL,
--- /dev/null
+-- For partial block restrictions --
+
+CREATE TABLE ipblocks_restrictions (
+ ir_ipb_id INTEGER NOT NULL REFERENCES ipblocks(ipb_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ ir_type SMALLINT NOT NULL,
+ ir_value INTEGER NOT NULL,
+ PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
+);
+
+-- Index to query restrictions by the page or namespace.
+CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
ipb_deleted SMALLINT NOT NULL DEFAULT 0,
ipb_block_email SMALLINT NOT NULL DEFAULT 0,
ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0,
- ipb_parent_block_id INTEGER NULL REFERENCES ipblocks(ipb_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
+ ipb_parent_block_id INTEGER NULL REFERENCES ipblocks(ipb_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
+ ipb_sitewide SMALLINT NOT NULL DEFAULT 1
);
ALTER SEQUENCE ipblocks_ipb_id_seq OWNED BY ipblocks.ipb_id;
CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only);
CREATE INDEX ipb_range ON ipblocks (ipb_range_start,ipb_range_end);
CREATE INDEX ipb_parent_block_id ON ipblocks (ipb_parent_block_id);
+CREATE TABLE ipblocks_restrictions (
+ ir_ipb_id INTEGER NOT NULL REFERENCES ipblocks(ipb_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ ir_type SMALLINT NOT NULL,
+ ir_value INTEGER NOT NULL,
+ PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
+);
+CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
+
CREATE TABLE image (
img_name TEXT NOT NULL PRIMARY KEY,
-- Autoblocks set this to the original block
-- so that the original block being deleted also
-- deletes the autoblocks
- ipb_parent_block_id int default NULL
+ ipb_parent_block_id int default NULL,
+
+ -- Block user from editing any page on the site (other than their own user
+ -- talk page).
+ ipb_sitewide bool NOT NULL default 1
) /*$wgDBTableOptions*/;
-- Index for removing autoblocks when a parent block is removed
CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
+--
+-- Partial Block Restrictions
+--
+CREATE TABLE /*_*/ipblocks_restrictions (
+
+ -- The ipb_id from ipblocks
+ ir_ipb_id int NOT NULL,
+
+ -- The restriction type id.
+ ir_type tinyint(1) NOT NULL,
+
+ -- The restriction id that corrposponds to the type. Typically a Page ID or a
+ -- Namespace ID.
+ ir_value int NOT NULL,
+
+ PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
+) /*$wgDBTableOptions*/;
+
+-- Index to query restrictions by the page or namespace.
+CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
--
-- Uploaded images and other files.