wulf-pulse/migrations/094_pax8_order_items_quantity_numeric.sql

14 lines
828 B
MySQL
Raw Normal View History

-- Fix: pax8_order_items.quantity was INTEGER (migration 091), but real PAX8
-- invoice items report fractional quantities for usage-based line items
-- (e.g. Azure per-unit bandwidth overage: quantity=44.7684). A live full sync
-- (12-05 verification) aborted the entire orders/order_items sync loop on
-- the first such row ("invalid input syntax for type integer: 44.7684"),
-- silently truncating SC#1's item coverage to a tiny partial subset instead
-- of the full ~56k-row history. Widen to NUMERIC to accept any PAX8 quantity
-- value; existing integer-valued rows convert losslessly.
--
-- pax8_subscriptions.quantity (seat counts) is untouched — no fractional
-- values observed there and it's out of scope for this fix.
ALTER TABLE pax8_order_items ALTER COLUMN quantity TYPE NUMERIC(14,4) USING quantity::numeric;