镜像自地址
https://github.com/wikimedia/mediawiki-extensions-WikiLove.git
已同步 2024-06-01 09:50:19 +08:00
Correct schema drift between abstract and old non-abstract
The logging feature is broken with the provided schema: Out of range value for column 'wll_receiver_registration' at row 1 Bug: T299800 Follow-Up: I9daf09b54c262f8ee366cf197f42ab8b6233310a Change-Id: I5347bb400fe6148beee802c4e87092156454c25f
这个提交包含在:
父节点
859faec603
当前提交
90a1d2532a
|
@ -28,17 +28,33 @@ class Hooks {
|
|||
*/
|
||||
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {
|
||||
$dbType = $updater->getDB()->getType();
|
||||
$path = dirname( __DIR__ ) . '/patches';
|
||||
if ( $dbType === 'mysql' ) {
|
||||
$updater->addExtensionTable( 'wikilove_log',
|
||||
dirname( __DIR__ ) . '/patches/tables-generated.sql'
|
||||
$path . '/tables-generated.sql'
|
||||
);
|
||||
$updater->modifyExtensionField(
|
||||
'wikilove_log',
|
||||
'wll_timestamp',
|
||||
$path . '/patch-wikilove_log-cleanup.sql'
|
||||
);
|
||||
} elseif ( $dbType === 'sqlite' ) {
|
||||
$updater->addExtensionTable( 'wikilove_log',
|
||||
dirname( __DIR__ ) . '/patches/sqlite/tables-generated.sql'
|
||||
$path . '/sqlite/tables-generated.sql'
|
||||
);
|
||||
$updater->modifyExtensionField(
|
||||
'wikilove_log',
|
||||
'wll_timestamp',
|
||||
$path . '/sqlite/patch-wikilove_log-cleanup.sql'
|
||||
);
|
||||
} elseif ( $dbType === 'postgres' ) {
|
||||
$updater->addExtensionTable( 'wikilove_log',
|
||||
dirname( __DIR__ ) . '/patches/postgres/tables-generated.sql'
|
||||
$path . '/postgres/tables-generated.sql'
|
||||
);
|
||||
$updater->modifyExtensionField(
|
||||
'wikilove_log',
|
||||
'wll_timestamp',
|
||||
$path . '/postgrespatch-wikilove_log-cleanup.sql'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
{
|
||||
"comment": "Correct field type of timestamp columns after abstract schema migration - T299800",
|
||||
"before": {
|
||||
"name": "wikilove_log",
|
||||
"comment": "WikiLove logging schema. Logs all actions of giving WikiLove.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "wll_id",
|
||||
"comment": "unique id",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_timestamp",
|
||||
"comment": "timestamp",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 14 }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender",
|
||||
"comment": "user id of the sender",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_registration",
|
||||
"comment": "registration date of the sender",
|
||||
"type": "binary",
|
||||
"options": { "notnull": false, "length": 14, "default": null }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_editcount",
|
||||
"comment": "wll_sender_editcount",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver",
|
||||
"comment": "user id of reciever",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_registration",
|
||||
"comment": "registration date of the receiver",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false, "default": null }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_editcount",
|
||||
"comment": "total number of edits for the receiver",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_type",
|
||||
"comment": "type (and subtype) of message",
|
||||
"type": "string",
|
||||
"options": { "notnull": true, "length": 64 }
|
||||
},
|
||||
{
|
||||
"name": "wll_subject",
|
||||
"comment": "subject line",
|
||||
"type": "string",
|
||||
"options": { "notnull": true, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "wll_message",
|
||||
"comment": "actual message",
|
||||
"type": "blob",
|
||||
"options": { "notnull": true, "length": 65530 }
|
||||
},
|
||||
{
|
||||
"name": "wll_email",
|
||||
"comment": "whether or not a notification mail has been sent",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "default": 0 }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "wll_timestamp",
|
||||
"columns": [ "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "wll_type_time",
|
||||
"columns": [ "wll_type", "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_time",
|
||||
"columns": [ "wll_sender", "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_time",
|
||||
"columns": [ "wll_receiver", "wll_timestamp" ],
|
||||
"unique": false
|
||||
}
|
||||
],
|
||||
"pk": [ "wll_id" ]
|
||||
},
|
||||
"after": {
|
||||
"name": "wikilove_log",
|
||||
"comment": "WikiLove logging schema. Logs all actions of giving WikiLove.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "wll_id",
|
||||
"comment": "unique id",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_timestamp",
|
||||
"comment": "timestamp",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender",
|
||||
"comment": "user id of the sender",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_registration",
|
||||
"comment": "registration date of the sender",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_editcount",
|
||||
"comment": "wll_sender_editcount",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver",
|
||||
"comment": "user id of reciever",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_registration",
|
||||
"comment": "registration date of the receiver",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_editcount",
|
||||
"comment": "total number of edits for the receiver",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_type",
|
||||
"comment": "type (and subtype) of message",
|
||||
"type": "string",
|
||||
"options": { "notnull": true, "length": 64 }
|
||||
},
|
||||
{
|
||||
"name": "wll_subject",
|
||||
"comment": "subject line",
|
||||
"type": "string",
|
||||
"options": { "notnull": true, "length": 255 }
|
||||
},
|
||||
{
|
||||
"name": "wll_message",
|
||||
"comment": "actual message",
|
||||
"type": "blob",
|
||||
"options": { "notnull": true, "length": 65530 }
|
||||
},
|
||||
{
|
||||
"name": "wll_email",
|
||||
"comment": "whether or not a notification mail has been sent",
|
||||
"type": "mwtinyint",
|
||||
"options": { "notnull": true, "length": 1, "default": 0 }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "wll_timestamp",
|
||||
"columns": [ "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "wll_type_time",
|
||||
"comment": "ASSUMPTION: once narrowed down to a single user (sender/receiver), we can afford a filesort as a single users will have only limited WikiLove messages from or to him/her. It's not worth the memory of extra indexes to cover all the combinations (sender/receiver/type => 8 indexes)",
|
||||
"columns": [ "wll_type", "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_time",
|
||||
"columns": [ "wll_sender", "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_time",
|
||||
"columns": [ "wll_receiver", "wll_timestamp" ],
|
||||
"unique": false
|
||||
}
|
||||
],
|
||||
"pk": [ "wll_id" ]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: patches/abstractSchemaChanges/patch-wikilove_log-cleanup.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
ALTER TABLE /*_*/wikilove_log
|
||||
CHANGE wll_timestamp wll_timestamp BINARY(14) NOT NULL,
|
||||
CHANGE wll_sender_registration wll_sender_registration BINARY(14) DEFAULT NULL,
|
||||
CHANGE wll_receiver_registration wll_receiver_registration BINARY(14) DEFAULT NULL,
|
||||
CHANGE wll_receiver_editcount wll_receiver_editcount INT DEFAULT NULL,
|
||||
CHANGE wll_email wll_email TINYINT(1) DEFAULT 0 NOT NULL;
|
|
@ -0,0 +1,20 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: patches/abstractSchemaChanges/patch-wikilove_log-cleanup.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
ALTER TABLE wikilove_log ALTER wll_timestamp TYPE TIMESTAMPTZ;
|
||||
ALTER TABLE wikilove_log ALTER wll_timestamp
|
||||
DROP DEFAULT;
|
||||
ALTER TABLE wikilove_log ALTER wll_timestamp TYPE TIMESTAMPTZ;
|
||||
ALTER TABLE wikilove_log ALTER wll_sender_registration TYPE TIMESTAMPTZ;
|
||||
ALTER TABLE wikilove_log ALTER wll_sender_registration
|
||||
DROP DEFAULT;
|
||||
ALTER TABLE wikilove_log ALTER wll_sender_registration TYPE TIMESTAMPTZ;
|
||||
ALTER TABLE wikilove_log ALTER wll_receiver_registration TYPE TIMESTAMPTZ;
|
||||
ALTER TABLE wikilove_log ALTER wll_receiver_registration
|
||||
DROP DEFAULT;
|
||||
ALTER TABLE wikilove_log ALTER wll_receiver_editcount
|
||||
DROP NOT NULL;
|
||||
ALTER TABLE wikilove_log ALTER wll_email TYPE SMALLINT;
|
||||
ALTER TABLE wikilove_log ALTER wll_email
|
||||
SET DEFAULT 0;
|
|
@ -1,20 +1,20 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaSql.php.
|
||||
-- Source: ./tables.json
|
||||
-- Source: patches/tables.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
CREATE TABLE wikilove_log (
|
||||
wll_id SERIAL NOT NULL,
|
||||
wll_timestamp TEXT NOT NULL,
|
||||
wll_timestamp TIMESTAMPTZ NOT NULL,
|
||||
wll_sender INT NOT NULL,
|
||||
wll_sender_registration TEXT DEFAULT NULL,
|
||||
wll_sender_registration TIMESTAMPTZ DEFAULT NULL,
|
||||
wll_sender_editcount INT DEFAULT NULL,
|
||||
wll_receiver INT NOT NULL,
|
||||
wll_receiver_registration INT DEFAULT NULL,
|
||||
wll_receiver_editcount INT NOT NULL,
|
||||
wll_receiver_registration TIMESTAMPTZ DEFAULT NULL,
|
||||
wll_receiver_editcount INT DEFAULT NULL,
|
||||
wll_type VARCHAR(64) NOT NULL,
|
||||
wll_subject VARCHAR(255) NOT NULL,
|
||||
wll_message TEXT NOT NULL,
|
||||
wll_email INT DEFAULT 0 NOT NULL,
|
||||
wll_email SMALLINT DEFAULT 0 NOT NULL,
|
||||
PRIMARY KEY(wll_id)
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: patches/abstractSchemaChanges/patch-wikilove_log-cleanup.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
DROP INDEX wll_timestamp;
|
||||
DROP INDEX wll_type_time;
|
||||
DROP INDEX wll_sender_time;
|
||||
DROP INDEX wll_receiver_time;
|
||||
CREATE TEMPORARY TABLE /*_*/__temp__wikilove_log AS
|
||||
SELECT wll_id, wll_timestamp, wll_sender, wll_sender_registration, wll_sender_editcount, wll_receiver, wll_receiver_registration, wll_receiver_editcount, wll_type, wll_subject, wll_message, wll_email
|
||||
FROM /*_*/wikilove_log;
|
||||
DROP TABLE /*_*/wikilove_log;
|
||||
CREATE TABLE /*_*/wikilove_log ( wll_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, wll_timestamp BLOB NOT NULL, wll_sender INTEGER UNSIGNED NOT NULL, wll_sender_registration BLOB DEFAULT NULL, wll_sender_editcount INTEGER DEFAULT NULL, wll_receiver INTEGER UNSIGNED NOT NULL, wll_receiver_registration BLOB DEFAULT NULL, wll_receiver_editcount INTEGER DEFAULT NULL, wll_type VARCHAR(64) NOT NULL, wll_subject VARCHAR(255) NOT NULL, wll_message BLOB NOT NULL, wll_email SMALLINT DEFAULT 0 NOT NULL );
|
||||
INSERT INTO /*_*/wikilove_log ( wll_id, wll_timestamp, wll_sender, wll_sender_registration, wll_sender_editcount, wll_receiver, wll_receiver_registration, wll_receiver_editcount, wll_type, wll_subject, wll_message, wll_email )
|
||||
SELECT wll_id, wll_timestamp, wll_sender, wll_sender_registration, wll_sender_editcount, wll_receiver, wll_receiver_registration, wll_receiver_editcount, wll_type, wll_subject, wll_message, wll_email
|
||||
FROM /*_*/__temp__wikilove_log;
|
||||
DROP TABLE /*_*/__temp__wikilove_log;
|
||||
CREATE INDEX wll_timestamp ON /*_*/wikilove_log (wll_timestamp);
|
||||
CREATE INDEX wll_type_time ON /*_*/wikilove_log (wll_type, wll_timestamp);
|
||||
CREATE INDEX wll_sender_time ON /*_*/wikilove_log (wll_sender, wll_timestamp);
|
||||
CREATE INDEX wll_receiver_time ON /*_*/wikilove_log (wll_receiver, wll_timestamp);
|
|
@ -1,5 +1,5 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaSql.php.
|
||||
-- Source: ./tables.json
|
||||
-- Source: patches/tables.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
CREATE TABLE /*_*/wikilove_log (
|
||||
|
@ -9,12 +9,12 @@ CREATE TABLE /*_*/wikilove_log (
|
|||
wll_sender_registration BLOB DEFAULT NULL,
|
||||
wll_sender_editcount INTEGER DEFAULT NULL,
|
||||
wll_receiver INTEGER UNSIGNED NOT NULL,
|
||||
wll_receiver_registration INTEGER DEFAULT NULL,
|
||||
wll_receiver_editcount INTEGER NOT NULL,
|
||||
wll_receiver_registration BLOB DEFAULT NULL,
|
||||
wll_receiver_editcount INTEGER DEFAULT NULL,
|
||||
wll_type VARCHAR(64) NOT NULL,
|
||||
wll_subject VARCHAR(255) NOT NULL,
|
||||
wll_message BLOB NOT NULL,
|
||||
wll_email INTEGER DEFAULT 0 NOT NULL
|
||||
wll_email SMALLINT DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX wll_timestamp ON /*_*/wikilove_log (wll_timestamp);
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaSql.php.
|
||||
-- Source: ./tables.json
|
||||
-- Source: patches/tables.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
CREATE TABLE /*_*/wikilove_log (
|
||||
wll_id INT AUTO_INCREMENT NOT NULL,
|
||||
wll_timestamp VARBINARY(14) NOT NULL,
|
||||
wll_timestamp BINARY(14) NOT NULL,
|
||||
wll_sender INT UNSIGNED NOT NULL,
|
||||
wll_sender_registration VARBINARY(14) DEFAULT NULL,
|
||||
wll_sender_registration BINARY(14) DEFAULT NULL,
|
||||
wll_sender_editcount INT DEFAULT NULL,
|
||||
wll_receiver INT UNSIGNED NOT NULL,
|
||||
wll_receiver_registration INT DEFAULT NULL,
|
||||
wll_receiver_editcount INT NOT NULL,
|
||||
wll_receiver_registration BINARY(14) DEFAULT NULL,
|
||||
wll_receiver_editcount INT DEFAULT NULL,
|
||||
wll_type VARCHAR(64) NOT NULL,
|
||||
wll_subject VARCHAR(255) NOT NULL,
|
||||
wll_message BLOB NOT NULL,
|
||||
wll_email INT DEFAULT 0 NOT NULL,
|
||||
wll_email TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
INDEX wll_timestamp (wll_timestamp),
|
||||
INDEX wll_type_time (wll_type, wll_timestamp),
|
||||
INDEX wll_sender_time (wll_sender, wll_timestamp),
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
{
|
||||
"name": "wll_timestamp",
|
||||
"comment": "timestamp",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 14 }
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender",
|
||||
|
@ -24,8 +24,8 @@
|
|||
{
|
||||
"name": "wll_sender_registration",
|
||||
"comment": "registration date of the sender",
|
||||
"type": "binary",
|
||||
"options": { "notnull": false, "length": 14, "default": null }
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_sender_editcount",
|
||||
|
@ -42,14 +42,14 @@
|
|||
{
|
||||
"name": "wll_receiver_registration",
|
||||
"comment": "registration date of the receiver",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false, "default": null }
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_receiver_editcount",
|
||||
"comment": "total number of edits for the receiver",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true }
|
||||
"options": { "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "wll_type",
|
||||
|
@ -72,8 +72,8 @@
|
|||
{
|
||||
"name": "wll_email",
|
||||
"comment": "whether or not a notification mail has been sent",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "default": 0 }
|
||||
"type": "mwtinyint",
|
||||
"options": { "notnull": true, "length": 1, "default": 0 }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
|
@ -84,6 +84,7 @@
|
|||
},
|
||||
{
|
||||
"name": "wll_type_time",
|
||||
"comment": "ASSUMPTION: once narrowed down to a single user (sender/receiver), we can afford a filesort as a single users will have only limited WikiLove messages from or to him/her. It's not worth the memory of extra indexes to cover all the combinations (sender/receiver/type => 8 indexes)",
|
||||
"columns": [ "wll_type", "wll_timestamp" ],
|
||||
"unique": false
|
||||
},
|
||||
|
|
正在加载...
在新工单中引用
屏蔽一个用户