move page_restrictions.pr_id to top in tables.sql
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 18 Nov 2013 18:47:53 +0000 (19:47 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Mon, 18 Nov 2013 18:47:53 +0000 (19:47 +0100)
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
maintenance/sqlite/archives/initial-indexes.sql
maintenance/tables.sql

index 7356c38..8a565d5 100644 (file)
@@ -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);
index 1a59be5..954c85d 100644 (file)
@@ -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);
index 53964aa..933ea44 100644 (file)
@@ -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);