CREATE TABLE IF NOT EXISTS `products_merchant_sync_log` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `product_id` INT(11) NOT NULL,
  `field_name` VARCHAR(64) NOT NULL,
  `old_value` TEXT NULL,
  `new_value` TEXT NULL,
  `sync_status` VARCHAR(16) NOT NULL DEFAULT 'pending',
  `sync_source` VARCHAR(32) NOT NULL DEFAULT 'products_ui',
  `merchant_account_id` VARCHAR(32) NULL,
  `merchant_product_id` VARCHAR(255) NULL,
  `offer_id` VARCHAR(255) NULL,
  `api_response` MEDIUMTEXT NULL,
  `error_message` TEXT NULL,
  `date_add` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_products_merchant_sync_product` (`product_id`),
  KEY `idx_products_merchant_sync_field` (`field_name`),
  KEY `idx_products_merchant_sync_status` (`sync_status`),
  KEY `idx_products_merchant_sync_date` (`date_add`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
