defmodule Microwaveprop.Propagation.GridTask do @moduledoc """ Schema for the `grid_tasks` table — a cross-language shared queue between Elixir's `PropagationGridWorker` (seeder) and the Rust `prop-grid-rs` worker (consumer). **This schema does NOT own the table.** The table is created by Ecto migrations but rows are written by Elixir seeders (`GridTaskEnqueuer`) and consumed/updated by Rust via direct SQL (`SELECT ... FOR UPDATE SKIP LOCKED`). No Ecto changeset is provided — the schema exists purely for compile-time field-name checking on Ecto queries, so that `from(t in GridTask, where: t.status == "queued")` catches typos (`t.stauts`) that are invisible in the legacy `from(t in "grid_tasks", ...)` string-table queries. """ use Ecto.Schema @type t :: %__MODULE__{} @primary_key {:id, :binary_id, autogenerate: false} @foreign_key_type :binary_id schema "grid_tasks" do field :run_time, :utc_datetime field :forecast_hour, :integer field :valid_time, :utc_datetime field :status, :string, default: "queued" field :attempt, :integer, default: 0 field :claimed_at, :utc_datetime_usec field :completed_at, :utc_datetime_usec field :error, :string field :kind, :string, default: "forecast" field :source, :string, default: "hrrr" timestamps(type: :utc_datetime) end end