
CREATE TABLE IF NOT EXISTS settings (`key` VARCHAR(190) PRIMARY KEY, `value` TEXT) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS campaigns (id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255), caption TEXT, media_url TEXT, targets JSON, created_at DATETIME) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS send_logs (id INT AUTO_INCREMENT PRIMARY KEY, campaign_id INT, ok JSON, errors JSON, created_at DATETIME, INDEX (campaign_id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS contacts (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(190), phone VARCHAR(64) UNIQUE, subscribed TINYINT(1) DEFAULT 1) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
