
ALTER TABLE ad_products
  ADD COLUMN IF NOT EXISTS price_3m_cents INT UNSIGNED NOT NULL DEFAULT 0 AFTER monthly_amount_cents,
  ADD COLUMN IF NOT EXISTS price_6m_cents INT UNSIGNED NOT NULL DEFAULT 0 AFTER price_3m_cents,
  ADD COLUMN IF NOT EXISTS price_12m_cents INT UNSIGNED NOT NULL DEFAULT 0 AFTER price_6m_cents;

UPDATE ad_products
SET
  price_3m_cents = CASE WHEN price_3m_cents = 0 THEN monthly_amount_cents ELSE price_3m_cents END,
  price_6m_cents = CASE WHEN price_6m_cents = 0 THEN monthly_amount_cents ELSE price_6m_cents END,
  price_12m_cents = CASE WHEN price_12m_cents = 0 THEN monthly_amount_cents ELSE price_12m_cents END;
