[
  {
    "type": "create_table",
    "description": "Create chat_templates table for Two-Way SMS Chat message templates",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'chat_templates'",
    "sql": "CREATE TABLE `chat_templates` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `typeNum` varchar(20) NOT NULL COMMENT 'Store identifier',\n  `short_name` varchar(50) NOT NULL COMMENT 'Quick reference name for template',\n  `content` text NOT NULL COMMENT 'Template content with placeholders',\n  `category` enum('transactional','initial_contact','follow_up') NOT NULL COMMENT 'Template category',\n  `character_count` smallint(5) unsigned DEFAULT NULL COMMENT 'Character count of content',\n  `sms_segment_count` tinyint(3) unsigned DEFAULT NULL COMMENT 'Estimated SMS segments',\n  `is_active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Whether template is available for use',\n  `is_system` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Whether this is a system-defined template',\n  `sort_order` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Display order in template list',\n  `created_by_employee_id` int(10) unsigned DEFAULT NULL COMMENT 'Employee who created template',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_shortname` (`typeNum`, `short_name`),\n  KEY `idx_category` (`typeNum`, `category`, `is_active`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Two-Way SMS Chat message templates'"
  }
]
