-- =============================================================================
-- Migration: Add agent_download_tokens table for one-time script downloads
-- =============================================================================

CREATE TABLE IF NOT EXISTS agent_download_tokens (
    token VARCHAR(100) PRIMARY KEY,
    project_id UUID NOT NULL REFERENCES edge_projects(id) ON DELETE CASCADE,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    expires_at TIMESTAMPTZ NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_agent_download_tokens_project ON agent_download_tokens(project_id);
