-- Migration 010: CMS Pages, SMS Password Reset, New Settings

-- 1. CMS Pages table
CREATE TABLE IF NOT EXISTS `cms_pages` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `slug` VARCHAR(255) NOT NULL UNIQUE,
    `title` VARCHAR(255) NOT NULL,
    `content` LONGTEXT,
    `meta_title` VARCHAR(255) DEFAULT NULL,
    `meta_description` TEXT,
    `status` ENUM('draft', 'published') NOT NULL DEFAULT 'draft',
    `created_by` INT DEFAULT NULL,
    `updated_by` INT DEFAULT NULL,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Insert default home page
INSERT IGNORE INTO `cms_pages` (`slug`, `title`, `status`) VALUES ('home', 'Home Page', 'draft');
