-- Migration: Add Burn API Support Setting to Users Table
-- Description: Adds burn_api_enabled column to users table for controlling profile access in burn-api
-- Date: 2025-09-25

ALTER TABLE users ADD COLUMN burn_api_enabled TINYINT(1) DEFAULT 0 COMMENT 'Enable profile access for burnyourex.games Burn API';

-- Index for performance when querying burn_api_enabled users
CREATE INDEX idx_users_burn_api_enabled ON users(burn_api_enabled);

-- Update existing users to have burn API disabled by default for privacy
UPDATE users SET burn_api_enabled = 0 WHERE burn_api_enabled IS NULL;

-- Add constraint to ensure only 0 or 1 values
ALTER TABLE users ADD CONSTRAINT chk_burn_api_enabled CHECK (burn_api_enabled IN (0, 1));