Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/190725
Change subject: Make column user_newtalk.user_id an unsigned int
......................................................................
Make column user_newtalk.user_id an unsigned int
The primary key of the user table is an unsigned int, the column
user_newtalk.user_id refer the id and should have the same typ to store
the same values as the user table does.
Bug: T77005
Change-Id: I641dc1fad0a5bb14815f55e0357243a562fd672b
---
M includes/db/DatabaseMysqlBase.php
M includes/installer/MysqlUpdater.php
A maintenance/archives/patch-user-newtalk-userid-unsigned.sql
M maintenance/tables.sql
4 files changed, 33 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/25/190725/1
diff --git a/includes/db/DatabaseMysqlBase.php
b/includes/db/DatabaseMysqlBase.php
index 458b286..c1f2969 100644
--- a/includes/db/DatabaseMysqlBase.php
+++ b/includes/db/DatabaseMysqlBase.php
@@ -1201,6 +1201,7 @@
$this->is_multiple = $info->multiple_key;
$this->is_key = ( $this->is_pk || $this->is_unique ||
$this->is_multiple );
$this->type = $info->type;
+ $this->flags = $info->flags;
$this->binary = isset( $info->binary ) ? $info->binary : false;
}
@@ -1250,6 +1251,13 @@
return $this->is_multiple;
}
+ /**
+ * @return int
+ */
+ function flags() {
+ return $this->flags;
+ }
+
function isBinary() {
return $this->binary;
}
diff --git a/includes/installer/MysqlUpdater.php
b/includes/installer/MysqlUpdater.php
index 81f563a..eada44a 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -270,6 +270,7 @@
array( 'dropTable', 'hitcounter' ),
array( 'dropField', 'site_stats', 'ss_total_views',
'patch-drop-ss_total_views.sql' ),
array( 'dropField', 'page', 'page_counter',
'patch-drop-page_counter.sql' ),
+ array( 'doUserNewTalkUseridUnsigned' ),
);
}
@@ -1062,4 +1063,26 @@
'Making iwl_prefix_title_from index non-UNIQUE'
);
}
+
+ protected function doUserNewTalkUseridUnsigned() {
+ if ( !$this->doTable( 'user_newtalk' ) ) {
+ return true;
+ }
+
+ $info = $this->db->fieldInfo( 'user_newtalk', 'user_id' );
+ if ( $info === false ) {
+ return true;
+ }
+ if ( ( $info->flags() & 32 /*MYSQLI_UNSIGNED_FLAG*/ ) ) {
+ $this->output( "...user_id is already unsigned int.\n"
);
+
+ return true;
+ }
+
+ return $this->applyPatch(
+ 'patch-user-newtalk-userid-unsigned.sql',
+ false,
+ 'Making user_id unsigned int'
+ );
+ }
}
diff --git a/maintenance/archives/patch-user-newtalk-userid-unsigned.sql
b/maintenance/archives/patch-user-newtalk-userid-unsigned.sql
new file mode 100644
index 0000000..a83e03b
--- /dev/null
+++ b/maintenance/archives/patch-user-newtalk-userid-unsigned.sql
@@ -0,0 +1 @@
+ALTER TABLE /*_*/user_newtalk MODIFY user_id int unsigned NOT NULL default 0;
diff --git a/maintenance/tables.sql b/maintenance/tables.sql
index 112ac05..4433502 100644
--- a/maintenance/tables.sql
+++ b/maintenance/tables.sql
@@ -182,7 +182,7 @@
--
CREATE TABLE /*_*/user_newtalk (
-- Key to user.user_id
- user_id int NOT NULL default 0,
+ user_id int unsigned NOT NULL default 0,
-- If the user is an anonymous user their IP address is stored here
-- since the user_id of 0 is ambiguous
user_ip varbinary(40) NOT NULL default '',
--
To view, visit https://gerrit.wikimedia.org/r/190725
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I641dc1fad0a5bb14815f55e0357243a562fd672b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits