In order to properly work, the Laravel Tus Upload package, uses a table to track upload requests and progress.
The database schema is composed by a single table.
|--------------------------------------|
| tus_uploads_queue |
|--------------------------------------|
| + id: autoincrement, primary key |
| + user_id: int |
| + request_id: string |
| + tus_id: string |
| + upload_token: string |
| + upload_token_expires_at: timestamp |
| + filename: string |
| + mimetype: string |
| + metadata: text |
| + size: unsignedBigInteger |
| + offset: unsignedBigInteger |
| + cancelled_at: timestamp |
| + completed_at: timestamp |
| + created_at: timestamp |
| + updated_at: timestamp |
Here is a brief description of all the fields:
request_id
the request identifier, generated by the client, to identify the requests in the queue of the uploadstus_id
: The identifier of the upload assigned by the tus server, this will correspond also to the name of the file in the tus storage. The value can be null as the id is generated only the first byte of the file are received by serverupload_token
the token generated by the server to let the client pass the upload verificationupload_token_expires_at
the token expiration timestampfilename
: The original name of the file subject to upload. This must be sent by the client uploader, because tus do not support using the real filenamesmimetype
(nullable): the mime type of the filemetadata
: a free text field (considered json by the code) that can host information about the upload. By default it stores all data sent by the client except the mimetype, the filename and the request_idsize
: the total size of the file in bytesoffset
: the current bytes transferredcancelled_at
: if the upload has been cancelled and whencompleted_at
: if the upload has been completed and when
Notes
To keep the implementation not dependendant on the Users table and model, the user_id
field, that defines the relationship with the user, is not a foreign key.