-- Track IFTA quarterly-return reminder touches per interstate carrier so the
-- multi-touch cadence (10/7/4 business days before deadline) never repeats a
-- touch and escalates correctly. Reset each new quarter by the IFTA builder.
--   ifta_reminded_at : timestamp of the most recent IFTA touch (any)
--   ifta_touch_no    : highest touch number sent this cycle (1=10d, 2=7d, 3=4d)

ALTER TABLE fmcsa_carriers
  ADD COLUMN IF NOT EXISTS ifta_reminded_at TIMESTAMPTZ,
  ADD COLUMN IF NOT EXISTS ifta_touch_no SMALLINT;

CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_fmcsa_carriers_ifta_reminded
  ON fmcsa_carriers (ifta_touch_no)
  WHERE carrier_operation = 'A';
