-- Add delegate_party_id column to mpc_sessions table
-- This column stores the ID of the delegate party that will return user's share
-- Only populated for keygen sessions with require_delegate=true
ALTER TABLE mpc_sessions ADD COLUMN delegate_party_id VARCHAR(255) DEFAULT '';

-- Add index for faster lookups by delegate party
CREATE INDEX idx_mpc_sessions_delegate_party ON mpc_sessions(delegate_party_id) WHERE delegate_party_id != '';

-- Add comment
COMMENT ON COLUMN mpc_sessions.delegate_party_id IS 'The delegate party ID that generates and returns user share (for keygen sessions with delegate)';
