-- Generic key/value application settings (SMTP, branding, captcha provider,
-- license info, ...). Typed so the admin UI can render the right control.
CREATE TABLE IF NOT EXISTS `settings` (
    `id`         BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    `key`        VARCHAR(100)    NOT NULL,
    `value`      TEXT            NULL,
    `type`       VARCHAR(20)     NOT NULL DEFAULT 'string', -- string/int/bool/json/secret
    `group`      VARCHAR(40)     NOT NULL DEFAULT 'general',
    `updated_at` DATETIME        NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uq_settings_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
