Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
859faec
commit 90a1d25
Showing
9 changed files
with
302 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
206 changes: 206 additions & 0 deletions
206
patches/abstractSchemaChanges/patch-wikilove_log-cleanup.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.