ALTER TABLE sold_items
    ADD COLUMN IF NOT EXISTS eis_transaction_type ENUM('B2C', 'B2B') NOT NULL DEFAULT 'B2C' AFTER buyer_tin;

ALTER TABLE sold_items
    ADD COLUMN IF NOT EXISTS buyer_authorization_code VARCHAR(100) DEFAULT NULL AFTER eis_transaction_type;

UPDATE sold_items
SET eis_transaction_type = 'B2B'
WHERE buyer_tin IS NOT NULL AND TRIM(buyer_tin) <> '';
