diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2021-12-24 01:17:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2021-12-24 01:17:07 +0000 |
commit | 736e15eb6bf49551f7b8300ea18c9f4abbef0a90 (patch) | |
tree | 271b20629cb60f03864387a906752fd91f5be5c6 | |
parent | ae411974c9cf2daa7d77266af4a04cd37b9da7c6 (diff) | |
parent | 45c84bf927da8c6e8c1a6d28f8d556e7978c1b0f (diff) |
Merge "schema: Make filearchive.fa_id unsigned"
-rw-r--r-- | includes/installer/MysqlUpdater.php | 1 | ||||
-rw-r--r-- | maintenance/abstractSchemaChanges/patch-filearchive-fa_id.json | 488 | ||||
-rw-r--r-- | maintenance/archives/patch-filearchive-fa_id.sql | 6 | ||||
-rw-r--r-- | maintenance/tables-generated.sql | 2 | ||||
-rw-r--r-- | maintenance/tables.json | 1 |
5 files changed, 497 insertions, 1 deletions
diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index d0eb786fedd1..c1748825c353 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -249,6 +249,7 @@ class MysqlUpdater extends DatabaseUpdater { // 1.38 [ 'doConvertDjvuMetadata' ], [ 'dropField', 'page_restrictions', 'pr_user', 'patch-drop-page_restrictions-pr_user.sql' ], + [ 'modifyField', 'filearchive', 'fa_id', 'patch-filearchive-fa_id.sql' ], ]; } diff --git a/maintenance/abstractSchemaChanges/patch-filearchive-fa_id.json b/maintenance/abstractSchemaChanges/patch-filearchive-fa_id.json new file mode 100644 index 000000000000..7b3b618273a2 --- /dev/null +++ b/maintenance/abstractSchemaChanges/patch-filearchive-fa_id.json @@ -0,0 +1,488 @@ +{ + "comment": "Set unsigned true for fa_id in filearchive table", + "before": { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + }, + "after": { + "name": "filearchive", + "comment": "Record of deleted file data", + "columns": [ + { + "name": "fa_id", + "comment": "Unique row id", + "type": "integer", + "options": { + "autoincrement": true, + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_name", + "comment": "Original base filename; key to image.img_name, page.page_title, etc", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 255 + } + }, + { + "name": "fa_archive_name", + "comment": "Filename of archived file, if an old revision", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 255 + } + }, + { + "name": "fa_storage_group", + "comment": "Which storage bin (directory tree or object store) the file data is stored in. Should be 'deleted' for files that have been deleted; any other bin is not yet in use.", + "type": "binary", + "options": { + "notnull": false, + "length": 16 + } + }, + { + "name": "fa_storage_key", + "comment": "SHA-1 of the file contents plus extension, used as a key for storage. eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg. If NULL, the file was missing at deletion time or has been purged from the archival storage.", + "type": "binary", + "options": { + "notnull": false, + "default": "", + "length": 64 + } + }, + { + "name": "fa_deleted_user", + "type": "integer", + "options": { + "notnull": false + } + }, + { + "name": "fa_deleted_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted_reason_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_size", + "type": "integer", + "options": { + "unsigned": true, + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_width", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_height", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_metadata", + "type": "blob", + "options": { + "notnull": false, + "length": 16777215 + } + }, + { + "name": "fa_bits", + "type": "integer", + "options": { + "notnull": false, + "default": 0 + } + }, + { + "name": "fa_media_type", + "type": "mwenum", + "options": { + "notnull": false, + "default": null, + "CustomSchemaOptions": { + "enum_values": [ "UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D" ] + } + } + }, + { + "name": "fa_major_mime", + "type": "mwenum", + "options": { + "notnull": false, + "default": "unknown", + "CustomSchemaOptions": { + "enum_values": [ "unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical" ] + } + } + }, + { + "name": "fa_minor_mime", + "type": "binary", + "options": { + "notnull": false, + "default": "unknown", + "length": 100 + } + }, + { + "name": "fa_description_id", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_actor", + "type": "bigint", + "options": { + "unsigned": true, + "notnull": true + } + }, + { + "name": "fa_timestamp", + "type": "mwtimestamp", + "options": { + "notnull": false, + "length": 14 + } + }, + { + "name": "fa_deleted", + "comment": "Visibility of deleted revisions, bitfield", + "type": "mwtinyint", + "options": { + "unsigned": true, + "notnull": true, + "default": 0 + } + }, + { + "name": "fa_sha1", + "comment": "sha1 hash of file content", + "type": "binary", + "options": { + "notnull": true, + "default": "", + "length": 32 + } + } + ], + "indexes": [ + { + "name": "fa_name", + "comment": "pick out by image name", + "columns": [ + "fa_name", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_storage_group", + "comment": "pick out dupe files", + "columns": [ + "fa_storage_group", + "fa_storage_key" + ], + "unique": false + }, + { + "name": "fa_deleted_timestamp", + "comment": "sort by deletion time", + "columns": [ + "fa_deleted_timestamp" + ], + "unique": false + }, + { + "name": "fa_actor_timestamp", + "comment": "sort by uploader", + "columns": [ + "fa_actor", + "fa_timestamp" + ], + "unique": false + }, + { + "name": "fa_sha1", + "comment": "find file by sha1, 10 bytes will be enough for hashes to be indexed", + "columns": [ + "fa_sha1" + ], + "unique": false, + "options": { "lengths": [ 10 ] } + } + ], + "pk": [ + "fa_id" + ] + } +} diff --git a/maintenance/archives/patch-filearchive-fa_id.sql b/maintenance/archives/patch-filearchive-fa_id.sql new file mode 100644 index 000000000000..2a651cfed072 --- /dev/null +++ b/maintenance/archives/patch-filearchive-fa_id.sql @@ -0,0 +1,6 @@ +-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. +-- Source: maintenance/abstractSchemaChanges/patch-filearchive-fa_id.json +-- Do not modify this file directly. +-- See https://www.mediawiki.org/wiki/Manual:Schema_changes +ALTER TABLE /*_*/filearchive +CHANGE fa_id fa_id INT UNSIGNED AUTO_INCREMENT NOT NULL;
\ No newline at end of file diff --git a/maintenance/tables-generated.sql b/maintenance/tables-generated.sql index 9f04f7be29c7..bf83783afbc1 100644 --- a/maintenance/tables-generated.sql +++ b/maintenance/tables-generated.sql @@ -574,7 +574,7 @@ CREATE TABLE /*_*/uploadstash ( CREATE TABLE /*_*/filearchive ( - fa_id INT AUTO_INCREMENT NOT NULL, + fa_id INT UNSIGNED AUTO_INCREMENT NOT NULL, fa_name VARBINARY(255) DEFAULT '' NOT NULL, fa_archive_name VARBINARY(255) DEFAULT '', fa_storage_group VARBINARY(16) DEFAULT NULL, diff --git a/maintenance/tables.json b/maintenance/tables.json index 0358a152fa26..4ad6227daf59 100644 --- a/maintenance/tables.json +++ b/maintenance/tables.json @@ -1949,6 +1949,7 @@ "type": "integer", "options": { "autoincrement": true, + "unsigned": true, "notnull": true } }, |