-- Migration 007: Add keygen_session_id to mpc_sessions table
-- Description: For sign sessions, this column stores the reference to the keygen session
--              whose key shares should be used for signing.

-- Add keygen_session_id column to mpc_sessions table
ALTER TABLE mpc_sessions ADD COLUMN keygen_session_id UUID;

-- Add index for efficient lookups
CREATE INDEX idx_mpc_sessions_keygen_session_id ON mpc_sessions(keygen_session_id);

-- Add comment
COMMENT ON COLUMN mpc_sessions.keygen_session_id IS 'For sign sessions: references the keygen session whose key shares to use';
