-- Store USD as decimal (e.g. 1.25 USD = 1.25). Convert existing bigint (1_000_000 = 1 USD) to decimal.

-- payments
ALTER TABLE payments ADD COLUMN usd_amount_new DECIMAL(20,2) NULL COMMENT 'USD amount as decimal' AFTER stars_amount;
UPDATE payments SET usd_amount_new = usd_amount / 1000000.0 WHERE usd_amount IS NOT NULL;
ALTER TABLE payments DROP COLUMN usd_amount;
ALTER TABLE payments CHANGE usd_amount_new usd_amount DECIMAL(20,2) NULL COMMENT 'USD amount (e.g. 1.25)';

-- payouts
ALTER TABLE payouts ADD COLUMN usd_amount_new DECIMAL(20,2) NULL COMMENT 'USD amount as decimal' AFTER stars_amount;
UPDATE payouts SET usd_amount_new = usd_amount / 1000000.0 WHERE usd_amount IS NOT NULL;
ALTER TABLE payouts DROP COLUMN usd_amount;
ALTER TABLE payouts CHANGE usd_amount_new usd_amount DECIMAL(20,2) NULL COMMENT 'USD amount (e.g. 1.25)';
