Ticket to download one data.
The reason why this table has site field instead of shop is this downloading cgi would be extracted from cassiopeia.
| Column | Type | Constraint | Description |
|---|---|---|---|
| site | TEXT | PRIMARY KEY | Site ID. (see shop.username) |
| id | INTEGER | Identifier. | |
| data_id | INTEGER | NOT NULL | Download data ID. (see downloadable_data.id) |
| code | TEXT | NOT NULL, UNIQUE | Identifier to certify download request. Randomized string. |
| remaining | INTEGER | Remaining number of download. NULL means unlimited. | |
| expires | TIMESTAMP | When this ticket will be expired. NULL means no expiry. |
CREATE TABLE download_ticket( site TEXT, id INTEGER, data_id INTEGER NOT NULL, code TEXT NOT NULL UNIQUE, remaining INTEGER, expires TIMESTAMP, PRIMARY KEY(site, id) );