defmodule Microwaveprop.Repo.Migrations.CreatePropagationRunTimings do use Ecto.Migration def change do create table(:propagation_run_timings, primary_key: false) do add :id, :binary_id, primary_key: true # `run_time` is the HRRR model cycle the chain is rolling through, # `forecast_hour` ∈ 0..18 picks the step within that chain. # (run_time, forecast_hour) is the natural key. add :run_time, :utc_datetime, null: false add :forecast_hour, :integer, null: false add :valid_time, :utc_datetime, null: false # Wall-clock window of this forecast hour's work, plus the total # in ms so queries don't have to recompute it. add :started_at, :utc_datetime_usec, null: false add :finished_at, :utc_datetime_usec, null: false add :duration_ms, :integer, null: false # "ok" when replace_scores returned {:ok, _}, "failed" otherwise. # `error` carries the inspected reason on failure, nil on success. add :status, :string, null: false add :error, :text timestamps(type: :utc_datetime, updated_at: false) end create unique_index(:propagation_run_timings, [:run_time, :forecast_hour]) create index(:propagation_run_timings, [:started_at]) end end