-- Run this if you already have the DB and need to add cms_page_images (e.g. in phpMyAdmin)
CREATE TABLE IF NOT EXISTS `cms_page_images` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `page_slug` varchar(64) NOT NULL,
  `image_key` varchar(64) NOT NULL,
  `image_url` varchar(512) NOT NULL DEFAULT '',
  `alt_text` varchar(255) DEFAULT NULL,
  `updated_by_admin_id` int unsigned DEFAULT NULL,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `page_image` (`page_slug`,`image_key`),
  KEY `page_slug` (`page_slug`),
  CONSTRAINT `cms_page_images_admin_fk` FOREIGN KEY (`updated_by_admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
