From 8175727af5477a3bff0630659f8419084e627827 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Mon, 18 Nov 2013 19:47:53 +0100 Subject: [PATCH] move page_restrictions.pr_id to top in tables.sql Having the primary key at the top of the column definition looks nicer and helps by finding him. Oracle and Postgres already have this moved up. Change-Id: Id8afbff35e165919f55dfcf1fd1dfaf1805d6aab --- maintenance/mssql/tables.sql | 2 +- maintenance/sqlite/archives/initial-indexes.sql | 4 ++-- maintenance/tables.sql | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/maintenance/mssql/tables.sql b/maintenance/mssql/tables.sql index 7356c38f75..8a565d5c6f 100644 --- a/maintenance/mssql/tables.sql +++ b/maintenance/mssql/tables.sql @@ -674,13 +674,13 @@ CREATE UNIQUE INDEX /*$wgDBprefix*/qcc_titletwo ON /*$wgDBprefix*/querycachetwo( --- Used for storing page restrictions (i.e. protection levels) CREATE TABLE /*$wgDBprefix*/page_restrictions ( + pr_id INT UNIQUE IDENTITY, pr_page INT NOT NULL REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE, pr_type NVARCHAR(200) NOT NULL, pr_level NVARCHAR(200) NOT NULL, pr_cascade SMALLINT NOT NULL, pr_user INT NULL, pr_expiry DATETIME NULL, - pr_id INT UNIQUE IDENTITY, CONSTRAINT /*$wgDBprefix*/pr_pagetype PRIMARY KEY(pr_page,pr_type), ); CREATE INDEX /*$wgDBprefix*/pr_page ON /*$wgDBprefix*/page_restrictions(pr_page); diff --git a/maintenance/sqlite/archives/initial-indexes.sql b/maintenance/sqlite/archives/initial-indexes.sql index 1a59be5aeb..954c85d3f3 100644 --- a/maintenance/sqlite/archives/initial-indexes.sql +++ b/maintenance/sqlite/archives/initial-indexes.sql @@ -237,13 +237,13 @@ CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki_tmp (iw_prefix); CREATE TABLE /*_*/page_restrictions_tmp ( + pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, pr_page int NOT NULL, pr_type varbinary(60) NOT NULL, pr_level varbinary(60) NOT NULL, pr_cascade tinyint NOT NULL, pr_user int NULL, - pr_expiry varbinary(14) NULL, - pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT + pr_expiry varbinary(14) NULL ); CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions_tmp (pr_page,pr_type); diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 53964aa127..933ea443db 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -1376,6 +1376,8 @@ CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo, -- Used for storing page restrictions (i.e. protection levels) CREATE TABLE /*_*/page_restrictions ( + -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages) + pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, -- Page to apply restrictions to (Foreign Key to page). pr_page int NOT NULL, -- The protection type (edit, move, etc) @@ -1387,9 +1389,7 @@ CREATE TABLE /*_*/page_restrictions ( -- Field for future support of per-user restriction. pr_user int NULL, -- Field for time-limited protection. - pr_expiry varbinary(14) NULL, - -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages) - pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT + pr_expiry varbinary(14) NULL ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type); -- 2.20.1