-- noinspection SqlDialectInspectionForFile -- -- NB: This version needs to be bumped even if just adding or changing comments! -- Failure to do so will cause Windows to segfault at start. (This is horrible!) -- -- NB: `app_state_dir.rs` contains the file version number. -- -- Migration history: -- tasks_v1.sqlite - initial version -- tasks_v2.sqlite - added model_type (nullable) -- tasks_v3.sqlite - added frontend_caller, comments CREATE TABLE tasks ( -- Task auto-incrementing primary key. -- We don't use this. id TEXT NOT NULL PRIMARY KEY, -- TaskStatus enum -- This is how the job system manages job states. -- e.g. pending, started, complete_success, dead, etc. task_status TEXT NOT NULL, -- TaskType enum -- e.g. image_generation, video_generation, etc. task_type TEXT NOT NULL, -- TaskModelType enum -- e.g. flux_1_dev, veo_2, etc. model_type TEXT, -- GenerationProvider enum -- Together with `provider_job_id`, this creates a foreign key lookup to the job. -- e.g. 'artcraft', 'fal', 'sora', etc. provider TEXT, -- The primary key for the job in the provider's system. provider_job_id TEXT, -- OPTIONAL. -- Tell the job system which caller initiated the task. -- e.g. 'canvas' frontend_caller TEXT, -- OPTIONAL. -- An arbitrary opaque identifier that frontend can set. frontend_subscriber_id TEXT, -- OPTIONAL. -- An opaque JSON payload set by the frontend subscriber that -- will be re-emitted back to the frontend. frontend_subscriber_payload TEXT, created_at INTEGER NOT NULL DEFAULT (unixepoch('now')), updated_at INTEGER NOT NULL DEFAULT (unixepoch('now')), completed_at INTEGER DEFAULT NULL ); -- Unique Indices CREATE UNIQUE INDEX idx_tasks_on_provider_job_id ON tasks(provider_job_id); -- Indices CREATE INDEX idx_tasks_on_status ON tasks(task_status); CREATE INDEX idx_tasks_on_provider ON tasks(provider);