-- BEGIN CHANGE: audit snapshot for shop history (item + pacc)
-- payload_json = snapshot da compra (offer, qty, choices, items)
-- to_player_id = players.id no momento da compra
-- buyer_ip = IP do comprador (X-Forwarded-For / REMOTE_ADDR)
-- quantity = multiplicador da compra (default 1)
-- Portal tambem aplica via waShopEnsureHistoryAuditCols().

ALTER TABLE `z_shop_history_item`
  ADD COLUMN `to_player_id` INT NOT NULL DEFAULT 0 AFTER `to_account`,
  ADD COLUMN `buyer_ip` VARCHAR(64) NOT NULL DEFAULT '' AFTER `from_account`,
  ADD COLUMN `quantity` INT NOT NULL DEFAULT 1 AFTER `price`,
  ADD COLUMN `payload_json` MEDIUMTEXT NULL AFTER `serial_item`;

ALTER TABLE `z_shop_history_pacc`
  ADD COLUMN `to_player_id` INT NOT NULL DEFAULT 0 AFTER `to_account`,
  ADD COLUMN `buyer_ip` VARCHAR(64) NOT NULL DEFAULT '' AFTER `from_account`,
  ADD COLUMN `quantity` INT NOT NULL DEFAULT 1 AFTER `price`,
  ADD COLUMN `payload_json` MEDIUMTEXT NULL AFTER `trans_real`;

-- END CHANGE
