Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 2.25 KB

database.md

File metadata and controls

48 lines (41 loc) · 2.25 KB

Database tables

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 uploads
  • tus_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 server
  • upload_token the token generated by the server to let the client pass the upload verification
  • upload_token_expires_atthe token expiration timestamp
  • filename: 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 filenames
  • mimetype (nullable): the mime type of the file
  • metadata: 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_id
  • size: the total size of the file in bytes
  • offset: the current bytes transferred
  • cancelled_at: if the upload has been cancelled and when
  • completed_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.