1 CREATE TABLE /*_*/filearchive_tmp (
3 fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
5 -- Original base filename; key to image.img_name, page.page_title, etc
6 fa_name varchar(255) binary NOT NULL default '',
8 -- Filename of archived file, if an old revision
9 fa_archive_name varchar(255) binary default '',
11 -- Which storage bin (directory tree or object store) the file data
12 -- is stored in. Should be 'deleted' for files that have been deleted;
13 -- any other bin is not yet in use.
14 fa_storage_group varbinary(16),
16 -- SHA-1 of the file contents plus extension, used as a key for storage.
17 -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg
19 -- If NULL, the file was missing at deletion time or has been purged
20 -- from the archival storage.
21 fa_storage_key varbinary(64) default '',
23 -- Deletion information, if this file is deleted.
25 fa_deleted_timestamp binary(14) default '',
26 fa_deleted_reason varbinary(767) default '',
27 -- Duped fields from image
28 fa_size int unsigned default 0,
29 fa_width int default 0,
30 fa_height int default 0,
31 fa_metadata mediumblob,
32 fa_bits int default 0,
33 fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
34 fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown",
35 fa_minor_mime varbinary(100) default "unknown",
36 fa_description varbinary(767),
37 fa_user int unsigned default 0,
38 fa_user_text varchar(255) binary,
39 fa_timestamp binary(14) default '',
41 -- Visibility of deleted revisions, bitfield
42 fa_deleted tinyint unsigned NOT NULL default 0,
44 -- sha1 hash of file content
45 fa_sha1 varbinary(32) NOT NULL default ''
46 ) /*$wgDBTableOptions*/;
49 INSERT INTO /*_*/filearchive_tmp
50 SELECT fa_id, fa_name, fa_archive_name, fa_storage_group, fa_storage_key, fa_deleted_user, fa_deleted_timestamp,
51 fa_deleted_reason, fa_size, fa_width, fa_height, fa_metadata, fa_bits, fa_media_type, fa_major_mime,
52 fa_minor_mime, fa_description, fa_user, fa_user_text, fa_timestamp, fa_deleted, fa_sha1
53 FROM /*_*/filearchive;
55 DROP TABLE /*_*/filearchive;
57 ALTER TABLE /*_*/filearchive_tmp RENAME TO /*_*/filearchive;
60 CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
61 CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key);
62 CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
63 CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
64 CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10));