feat: add auto-increment id, size/duration tracking, and soft cleanup to conversion_jobs

Rename the old CHAR(36) id to uuid (still used for public URLs and file
naming) and add a real auto-increment id as the primary key. Track
input/output file size and conversion duration per job. Cleanup no
longer deletes rows; it marks cleaned_at and skips already-cleaned
expired jobs on later runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 22:06:32 +02:00
co-authored by Claude Sonnet 5
parent 24f7ab2625
commit ff5a257a0e
10 changed files with 208 additions and 117 deletions
+7 -1
View File
@@ -1,5 +1,6 @@
CREATE TABLE IF NOT EXISTS conversion_jobs (
id CHAR(36) NOT NULL PRIMARY KEY,
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
uuid CHAR(36) NOT NULL,
status ENUM('pending', 'processing', 'done', 'failed') NOT NULL DEFAULT 'pending',
family VARCHAR(32) NOT NULL,
source_format VARCHAR(16) NOT NULL,
@@ -9,11 +10,16 @@ CREATE TABLE IF NOT EXISTS conversion_jobs (
output_path VARCHAR(255) NULL,
input_mime_type VARCHAR(128) NOT NULL,
output_mime_type VARCHAR(128) NULL,
input_size_bytes INT UNSIGNED NOT NULL,
output_size_bytes INT UNSIGNED NULL,
conversion_duration_seconds DECIMAL(10,3) NULL,
error_message VARCHAR(255) NULL,
error_log TEXT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
expires_at DATETIME NOT NULL,
cleaned_at DATETIME NULL DEFAULT NULL,
UNIQUE KEY uniq_uuid (uuid),
INDEX idx_status (status),
INDEX idx_expires_at (expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;