-- =============================================================================
-- BeKind Backend — Auth Magic Link (Future)
-- Table: magic_link_tokens
-- Purpose: Passwordless login via magic link (email-based authentication)
-- Depends on: 001-auth-schema.sql (users)
--
-- FUTURE: Uncomment and run this migration when implementing passwordless login
-- =============================================================================

-- Magic link tokens (for passwordless login)
-- Uncomment below when implementing passwordless login

-- CREATE TABLE IF NOT EXISTS magic_link_tokens (
--     id         UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
--     user_id    UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
--     token_hash CHAR(64) UNIQUE NOT NULL,
--     expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
--     used_at    TIMESTAMP WITH TIME ZONE,
--     created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
-- );

-- =============================================================================
-- INDEXES
-- =============================================================================

-- CREATE INDEX IF NOT EXISTS idx_magic_link_tokens_user_id    ON magic_link_tokens(user_id);
-- CREATE INDEX IF NOT EXISTS idx_magic_link_tokens_expires_at ON magic_link_tokens(expires_at);
