-- 039: Add a status column to theses to track submission lifecycle
--
-- Lifecycle:
--   draft  — thesis row created, file operations not yet completed (or failed)
--   active — all file operations succeeded, submission is complete
--
-- Separate from is_published (visibility).  The admin can filter drafts
-- to find orphaned/broken submissions and the cleanup-drafts job targets
-- status='draft' rows older than a threshold.

ALTER TABLE theses ADD COLUMN status TEXT NOT NULL DEFAULT 'active';

-- Existing theses already have files → they are active.
-- New theses start as draft and are promoted to active after file ops succeed.
