From 6364231cb974524fae34e69e031602c9e847a646 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 25 Feb 2007 21:19:32 +0000 Subject: [PATCH] *Create unique index pr_pagetype for PostgreSQL to fix protection breakage (bug 9097)/ add key name for clearity for MySQL --- maintenance/archives/patch-page_restrictions.sql | 2 +- maintenance/mysql5/tables-binary.sql | 2 +- maintenance/mysql5/tables.sql | 2 +- maintenance/postgres/tables.sql | 4 ++-- maintenance/tables.sql | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/maintenance/archives/patch-page_restrictions.sql b/maintenance/archives/patch-page_restrictions.sql index eb80527772..b4ef34be63 100644 --- a/maintenance/archives/patch-page_restrictions.sql +++ b/maintenance/archives/patch-page_restrictions.sql @@ -13,7 +13,7 @@ CREATE TABLE /*$wgDBprefix*/page_restrictions ( -- Field for time-limited protection. pr_expiry char(14) binary NULL, - PRIMARY KEY (pr_page,pr_type), + PRIMARY KEY pr_pagetype (pr_page,pr_type), KEY pr_page (pr_page), KEY pr_typelevel (pr_type,pr_level), diff --git a/maintenance/mysql5/tables-binary.sql b/maintenance/mysql5/tables-binary.sql index 7f970f94ae..d7d3b2cbca 100644 --- a/maintenance/mysql5/tables-binary.sql +++ b/maintenance/mysql5/tables-binary.sql @@ -1112,7 +1112,7 @@ CREATE TABLE /*$wgDBprefix*/page_restrictions ( -- Field for time-limited protection. pr_expiry char(14) binary NULL, - PRIMARY KEY (pr_page,pr_type), + PRIMARY KEY pr_pagetype (pr_page,pr_type), KEY pr_page (pr_page), KEY pr_typelevel (pr_type,pr_level), diff --git a/maintenance/mysql5/tables.sql b/maintenance/mysql5/tables.sql index 11c9b16514..6ea624324c 100644 --- a/maintenance/mysql5/tables.sql +++ b/maintenance/mysql5/tables.sql @@ -1103,7 +1103,7 @@ CREATE TABLE /*$wgDBprefix*/page_restrictions ( -- Field for time-limited protection. pr_expiry char(14) binary NULL, - PRIMARY KEY (pr_page,pr_type), + PRIMARY KEY pr_pagetype (pr_page,pr_type), KEY pr_page (pr_page), KEY pr_typelevel (pr_type,pr_level), diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index a934d93262..868bc5c072 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -111,7 +111,7 @@ CREATE TABLE pagecontent ( -- replaces reserved word 'text' CREATE SEQUENCE pr_id_val; CREATE TABLE page_restrictions ( - pr_id INTEGER NOT NULL UNIQUE DEFAULT nextval('pr_id_val'), + pr_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('pr_id_val'), pr_page INTEGER NULL REFERENCES page (page_id) ON DELETE CASCADE, pr_type TEXT NOT NULL, pr_level TEXT NOT NULL, @@ -119,7 +119,7 @@ CREATE TABLE page_restrictions ( pr_user INTEGER NULL, pr_expiry TIMESTAMPTZ NULL ); -ALTER TABLE page_restrictions ADD CONSTRAINT page_restrictions_pk PRIMARY KEY (pr_page,pr_type); +CREATE UNIQUE INDEX pr_pagetype ON page_restrictions (pr_page,pr_type); CREATE TABLE archive2 ( diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 28339f6c07..8dc09d267a 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -1097,7 +1097,7 @@ CREATE TABLE /*$wgDBprefix*/page_restrictions ( -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages) pr_id int unsigned not null auto_increment, - PRIMARY KEY (pr_page,pr_type), + PRIMARY KEY pr_pagetype (pr_page,pr_type), UNIQUE KEY pr_id (pr_id), KEY pr_page (pr_page), -- 2.20.1