-- Migration: 008_add_co_managed_wallet_fields (rollback)
-- Description: Remove wallet_name and invite_code fields and revert session_type constraint

-- Drop the index for invite_code
DROP INDEX IF EXISTS idx_mpc_sessions_invite_code;

-- Remove the columns
ALTER TABLE mpc_sessions
    DROP COLUMN IF EXISTS wallet_name,
    DROP COLUMN IF EXISTS invite_code;

-- Drop the updated session_type constraint
ALTER TABLE mpc_sessions DROP CONSTRAINT IF EXISTS chk_session_type;

-- Restore the original session_type constraint
ALTER TABLE mpc_sessions
    ADD CONSTRAINT chk_session_type CHECK (session_type IN ('keygen', 'sign'));
