From c490dc8164c625656630e918ef1c9767caa859ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 27 Apr 2021 21:15:05 +0200 Subject: [PATCH] Change DB column types from "string" to "binary" (VARCHAR to VARBINARY in MySQL) Per Manuel Arostegui in T263817#7033384. As I understand, this is just for consistency with tables in MediaWiki core. Given that all tables are created with "DEFAULT CHARSET=binary" (as defined in $wgDBTableOptions), there is no difference in behavior between these two types. Bug: T263817 Change-Id: I8dabcb45e447e0bf60b119fd4f7d6532147a44fc --- sql/discussiontools_subscription.json | 6 +++--- sql/mysql/discussiontools_subscription.sql | 6 +++--- sql/postgres/discussiontools_subscription.sql | 6 +++--- sql/sqlite/discussiontools_subscription.sql | 9 +++------ 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/sql/discussiontools_subscription.json b/sql/discussiontools_subscription.json index ae07dd9ad..e5eefd44c 100644 --- a/sql/discussiontools_subscription.json +++ b/sql/discussiontools_subscription.json @@ -14,7 +14,7 @@ { "name": "sub_item", "comment": "Internal name used to identify this item across all pages and revisions where it might appear, see CommentParser::computeName()", - "type": "string", + "type": "binary", "options": { "notnull": true, "length": 255 @@ -32,7 +32,7 @@ { "name": "sub_title", "comment": "Title of the page where this item appeared when the user subscribed to it", - "type": "string", + "type": "binary", "options": { "notnull": true, "length": 255 @@ -41,7 +41,7 @@ { "name": "sub_section", "comment": "Section of the page where this item appeared when the user subscribed to it", - "type": "string", + "type": "binary", "options": { "notnull": true, "length": 255 diff --git a/sql/mysql/discussiontools_subscription.sql b/sql/mysql/discussiontools_subscription.sql index 5a36b8863..7dec0ac90 100644 --- a/sql/mysql/discussiontools_subscription.sql +++ b/sql/mysql/discussiontools_subscription.sql @@ -4,10 +4,10 @@ -- See https://www.mediawiki.org/wiki/Manual:Schema_changes CREATE TABLE /*_*/discussiontools_subscription ( sub_id INT UNSIGNED AUTO_INCREMENT NOT NULL, - sub_item VARCHAR(255) NOT NULL, + sub_item VARBINARY(255) NOT NULL, sub_namespace INT DEFAULT 0 NOT NULL, - sub_title VARCHAR(255) NOT NULL, - sub_section VARCHAR(255) NOT NULL, + sub_title VARBINARY(255) NOT NULL, + sub_section VARBINARY(255) NOT NULL, sub_state INT DEFAULT 1 NOT NULL, sub_user INT UNSIGNED NOT NULL, sub_created BINARY(14) NOT NULL, diff --git a/sql/postgres/discussiontools_subscription.sql b/sql/postgres/discussiontools_subscription.sql index 112f7dde5..f4f7b6e85 100644 --- a/sql/postgres/discussiontools_subscription.sql +++ b/sql/postgres/discussiontools_subscription.sql @@ -4,10 +4,10 @@ -- See https://www.mediawiki.org/wiki/Manual:Schema_changes CREATE TABLE discussiontools_subscription ( sub_id SERIAL NOT NULL, - sub_item VARCHAR(255) NOT NULL, + sub_item TEXT NOT NULL, sub_namespace INT DEFAULT 0 NOT NULL, - sub_title VARCHAR(255) NOT NULL, - sub_section VARCHAR(255) NOT NULL, + sub_title TEXT NOT NULL, + sub_section TEXT NOT NULL, sub_state INT DEFAULT 1 NOT NULL, sub_user INT NOT NULL, sub_created TIMESTAMPTZ NOT NULL, diff --git a/sql/sqlite/discussiontools_subscription.sql b/sql/sqlite/discussiontools_subscription.sql index 58b0cd52f..70a923fcb 100644 --- a/sql/sqlite/discussiontools_subscription.sql +++ b/sql/sqlite/discussiontools_subscription.sql @@ -4,14 +4,11 @@ -- See https://www.mediawiki.org/wiki/Manual:Schema_changes CREATE TABLE /*_*/discussiontools_subscription ( sub_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - sub_item VARCHAR(255) NOT NULL, - sub_namespace INTEGER DEFAULT 0 NOT NULL, - sub_title VARCHAR(255) NOT NULL, - sub_section VARCHAR(255) NOT NULL, + sub_item BLOB NOT NULL, sub_namespace INTEGER DEFAULT 0 NOT NULL, + sub_title BLOB NOT NULL, sub_section BLOB NOT NULL, sub_state INTEGER DEFAULT 1 NOT NULL, sub_user INTEGER UNSIGNED NOT NULL, - sub_created BLOB NOT NULL, - sub_notified BLOB DEFAULT NULL + sub_created BLOB NOT NULL, sub_notified BLOB DEFAULT NULL ); CREATE UNIQUE INDEX discussiontools_subscription_itemuser ON /*_*/discussiontools_subscription (sub_item, sub_user);