CREATE TABLE asm3_import_jobs (
 id INTEGER PRIMARY KEY AUTOINCREMENT,
 original_name TEXT NOT NULL,
 stored_name TEXT NOT NULL UNIQUE,
 source_sha256 TEXT NOT NULL,
 status TEXT NOT NULL DEFAULT 'analyzed' CHECK(status IN ('analyzed','completed','failed')),
 analysis_json TEXT NOT NULL,
 result_json TEXT,
 created_by INTEGER,
 created_at TEXT NOT NULL DEFAULT(datetime('now')),
 completed_at TEXT,
 FOREIGN KEY(created_by) REFERENCES users(id) ON DELETE SET NULL
);
