CREATE TABLE IF NOT EXISTS `campaign_keywords` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `campaign_id` int(11) NOT NULL,
  `ad_group_id` int(11) NOT NULL,
  `keyword_text` varchar(255) NOT NULL,
  `match_type` varchar(40) DEFAULT NULL,
  `impressions_30` int(11) NOT NULL DEFAULT 0,
  `clicks_30` int(11) NOT NULL DEFAULT 0,
  `cost_30` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `conversions_30` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `conversion_value_30` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `roas_30` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `impressions_all_time` int(11) NOT NULL DEFAULT 0,
  `clicks_all_time` int(11) NOT NULL DEFAULT 0,
  `cost_all_time` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `conversions_all_time` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `conversion_value_all_time` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `roas_all_time` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `date_sync` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_campaign_keywords` (`campaign_id`,`ad_group_id`,`keyword_text`(191),`match_type`),
  KEY `idx_campaign_keywords_campaign_id` (`campaign_id`),
  KEY `idx_campaign_keywords_ad_group_id` (`ad_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
