Runtime API for backfilling event-grain device columns from stored user agents.
This module is safe to call from compiled application code, releases, remote consoles, or local maintenance tooling. It intentionally does not depend on Mix so deployed environments can run the backfill directly.
Summary
Types
@type cursor() :: %{id: Ecto.UUID.t(), inserted_at: DateTime.t()}
Functions
@spec run(keyword()) :: {:ok, non_neg_integer()}
Backfills all remaining events in batches.
Options:
:batch_size- maximum rows to process per batch. Defaults to5000.
Returns {:ok, total_updated} after all currently eligible rows have been
processed. Eligible rows have device_type IS NULL and a non-NULL
user_agent.
@spec run_batch(keyword()) :: {:updated, non_neg_integer(), cursor()} | {:done, 0}
Backfills one batch of events.
Returns {:updated, count, cursor} when rows were updated, or {:done, 0}
when no eligible rows remain.