-- Migration: Add settings table
-- Date: 2025-11-11
-- Description: Create settings table for system configuration

-- Create settings table
CREATE TABLE IF NOT EXISTS settings (
    id INT AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(255) NOT NULL DEFAULT 'Survey Manager',
    logo VARCHAR(500) DEFAULT NULL,
    description TEXT DEFAULT NULL,
    tags TEXT DEFAULT NULL,
    time_zone VARCHAR(50) NOT NULL DEFAULT 'America/New_York',
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Insert default settings (only if table is empty)
INSERT INTO settings (title, description, tags, time_zone)
SELECT 'Survey Manager',
       'A professional administrative panel for managing surveys and analyzing temperament profiles',
       'surveys,temperament,analysis,admin',
       'America/New_York'
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM settings LIMIT 1);
