-- Migration: 043_add_detail_to_attributes.sql
-- Date: 2026-04-16
-- Description: Add optional `detail` TEXT column to `attributes` table.
--              Stores a free-text description for user-specific custom attributes
--              (e.g. "Loves singing and music"). Common attributes leave this NULL.

SET @col_exists = (SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'attributes' AND COLUMN_NAME = 'detail');
SET @sql = IF(@col_exists = 0,
  'ALTER TABLE attributes ADD COLUMN detail TEXT NULL DEFAULT NULL AFTER name',
  'SELECT 1');
PREPARE _stmt FROM @sql; EXECUTE _stmt; DEALLOCATE PREPARE _stmt;
