-- Migration: 0004_create_settings_table
-- Phase 5 (Admin Panel). Runtime-editable key/value settings that
-- the Admin panel can change WITHOUT a code deploy — e.g. the free
-- daily quota and the Avalai API key. Values here always take
-- precedence over the .env/config fallback (see Services\SettingsService).

CREATE TABLE IF NOT EXISTS settings (
    setting_key   VARCHAR(64) PRIMARY KEY,
    setting_value TEXT        NULL,
    updated_at    DATETIME    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
