download_ticket

Description

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.

Definition

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.

Related tables

Query

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)
);