-- Add missing columns to logs table
ALTER TABLE `logs` 
ADD COLUMN `pwd_count` int(11) DEFAULT 0 AFTER `Passwords`,
ADD COLUMN `cc_count` int(11) DEFAULT 0 AFTER `CreditCards`,
ADD COLUMN `cookies_count` int(11) DEFAULT 0 AFTER `Cookies`,
ADD COLUMN `wallets_count` int(11) DEFAULT 0 AFTER `Wallets`,
ADD COLUMN `vpn_count` int(11) DEFAULT 0 AFTER `VPN`,
ADD COLUMN `cloud_storage_count` int(11) DEFAULT 0 AFTER `CloudStorage`,
ADD COLUMN `dev_tools_count` int(11) DEFAULT 0 AFTER `DevTools`,
ADD COLUMN `remote_access_count` int(11) DEFAULT 0 AFTER `RemoteAccess`,
ADD COLUMN `last_updated` timestamp NOT NULL DEFAULT current_timestamp() AFTER `BrowserExtended`;

-- Copy data from bot_stats to logs
UPDATE `logs` l
JOIN `bot_stats` b ON l.hwid = b.hwid
SET 
  l.pwd_count = b.pwd_count,
  l.cc_count = b.cc_count,
  l.cookies_count = b.cookies_count,
  l.wallets_count = b.wallets_count,
  l.vpn_count = b.vpn_count,
  l.cloud_storage_count = b.cloud_storage_count,
  l.dev_tools_count = b.dev_tools_count,
  l.remote_access_count = b.remote_access_count,
  l.last_updated = b.last_updated;

-- Drop bot_stats table
DROP TABLE IF EXISTS `bot_stats`; 