2 -- Store information about newly uploaded files before they're
3 -- moved into the actual filestore
5 CREATE TABLE /*_*/uploadstash (
6 us_id int unsigned NOT NULL PRIMARY KEY auto_increment,
8 -- the user who uploaded the file.
9 us_user int unsigned NOT NULL,
11 -- file key. this is how applications actually search for the file.
12 -- this might go away, or become the primary key.
13 us_key varchar(255) NOT NULL,
16 us_orig_path varchar(255) NOT NULL,
18 -- the temporary path at which the file is actually stored
19 us_path varchar(255) NOT NULL,
21 -- which type of upload the file came from (sometimes)
22 us_source_type varchar(50),
24 -- the date/time on which the file was added
25 us_timestamp varbinary(14) not null,
27 us_status varchar(50) not null,
29 -- file properties from File::getPropsFromPath. these may prove unnecessary.
31 us_size int unsigned NOT NULL,
32 -- this hash comes from File::sha1Base36(), and is 31 characters
33 us_sha1 varchar(31) NOT NULL,
35 -- Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table
36 us_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
37 -- image-specific properties
38 us_image_width int unsigned,
39 us_image_height int unsigned,
40 us_image_bits smallint unsigned
41 ) /*$wgDBTableOptions*/;
43 -- sometimes there's a delete for all of a user's stuff.
44 CREATE INDEX /*i*/us_user ON /*_*/uploadstash (us_user);
45 -- pick out files by key, enforce key uniqueness
46 CREATE UNIQUE INDEX /*i*/us_key ON /*_*/uploadstash (us_key);
47 -- the abandoned upload cleanup script needs this
48 CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp);