aboutsummaryrefslogtreecommitdiffstats
path: root/sql/sqlite/patch-drop-page_restrictions-pr_user.sql
diff options
context:
space:
mode:
authorDaimona Eaytoy <daimona.wiki@gmail.com>2024-12-12 23:47:46 +0100
committerDaimona Eaytoy <daimona.wiki@gmail.com>2024-12-13 14:59:35 +0000
commit09cdb3b66869998615a742caabe3a9cc32d8e991 (patch)
treea131090755c519bdfca581fd59274310e786c1c1 /sql/sqlite/patch-drop-page_restrictions-pr_user.sql
parent2d8285583f1866a0b00ec4df8365fb5fc63e0072 (diff)
downloadmediawikicore-09cdb3b66869998615a742caabe3a9cc32d8e991.tar.gz
mediawikicore-09cdb3b66869998615a742caabe3a9cc32d8e991.zip
Re-generate all schema change files
This gives us a solid baseline to use for automated tests. Whitespace differences will be ignored by the test, but regenerate these anyway because they're much more readable now, and it's generally nice to have a clean baseline. Differences are due to: - JSON files being moved in T382030 - JSON paths in the autogenerated comment are now standardized (I358cc24798f518d7) - Whitespace changes from Ib2f60b492ced8ff - Actual SQL changes from newer versions of doctrine/dbal There's also one important exception: the SQLite schema change for patch-page-rename-name_title-index no longer matches the JSON file since I17e73d5ef1. There doesn't seem to be a super-simple way around this, because we don't know the state of the database pre-update. On top of that, I believe that removing the field from the .sql file as done in I17e73d5ef1 could've caused data loss when upgrading from old versions: the column could be silently dropped before running the DB update that correctly migrates and drop the column. This is something to keep in mind going forwards, and T381981 will prevent it from happening that easily. But for the update in question, it's probably too late, so just update the JSON file to match the .sql files. Bug: T381981 Bug: T382030 Change-Id: I3a3acc0935409d4601eb172664580b13d5fe2340
Diffstat (limited to 'sql/sqlite/patch-drop-page_restrictions-pr_user.sql')
-rw-r--r--sql/sqlite/patch-drop-page_restrictions-pr_user.sql57
1 files changed, 40 insertions, 17 deletions
diff --git a/sql/sqlite/patch-drop-page_restrictions-pr_user.sql b/sql/sqlite/patch-drop-page_restrictions-pr_user.sql
index f0880ae6797b..0971beddf76e 100644
--- a/sql/sqlite/patch-drop-page_restrictions-pr_user.sql
+++ b/sql/sqlite/patch-drop-page_restrictions-pr_user.sql
@@ -1,21 +1,44 @@
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
--- Source: maintenance/abstractSchemaChanges/patch-drop-page_restrictions-pr_user.json
+-- Source: sql/abstractSchemaChanges/patch-drop-page_restrictions-pr_user.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
-DROP INDEX pr_pagetype;
-DROP INDEX pr_typelevel;
-DROP INDEX pr_level;
-DROP INDEX pr_cascade;
CREATE TEMPORARY TABLE /*_*/__temp__page_restrictions AS
-SELECT pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry
-FROM /*_*/page_restrictions;
-DROP TABLE /*_*/page_restrictions;
-CREATE TABLE /*_*/page_restrictions ( pr_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, pr_page INTEGER NOT NULL, pr_type BLOB NOT NULL, pr_level BLOB NOT NULL, pr_cascade SMALLINT NOT NULL, pr_expiry BLOB DEFAULT NULL );
-INSERT INTO /*_*/page_restrictions ( pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry )
-SELECT pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_expiry
-FROM /*_*/__temp__page_restrictions;
-DROP TABLE /*_*/__temp__page_restrictions;
-CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page, pr_type);
-CREATE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type, pr_level);
-CREATE INDEX pr_level ON /*_*/page_restrictions (pr_level);
-CREATE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade);
+SELECT
+ pr_id,
+ pr_page,
+ pr_type,
+ pr_level,
+ pr_cascade,
+ pr_expiry
+FROM /*_*/page_restrictions;
+DROP TABLE /*_*/page_restrictions;
+
+
+CREATE TABLE /*_*/page_restrictions (
+ pr_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ pr_page INTEGER NOT NULL, pr_type BLOB NOT NULL,
+ pr_level BLOB NOT NULL, pr_cascade SMALLINT NOT NULL,
+ pr_expiry BLOB DEFAULT NULL
+ );
+INSERT INTO /*_*/page_restrictions (
+ pr_id, pr_page, pr_type, pr_level,
+ pr_cascade, pr_expiry
+ )
+SELECT
+ pr_id,
+ pr_page,
+ pr_type,
+ pr_level,
+ pr_cascade,
+ pr_expiry
+FROM
+ /*_*/__temp__page_restrictions;
+DROP TABLE /*_*/__temp__page_restrictions;
+
+CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page, pr_type);
+
+CREATE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type, pr_level);
+
+CREATE INDEX pr_level ON /*_*/page_restrictions (pr_level);
+
+CREATE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade);