605 B · text History b868907
defmodule GitGud.Workflows.WorkflowSchedule do
  @moduledoc """
  One `on: schedule: - cron:` entry of a workflow on a repository's
  default branch, kept in step with the file by
  `GitGud.Workflows.Schedules.sync/1`. `last_fired_at` is the UTC minute
  it last fired, so two nodes ticking the same minute fire it once.
  """
  use Ecto.Schema

  alias GitGud.Repositories.Repository

  schema "workflow_schedules" do
    field :workflow_path, :string
    field :cron, :string
    field :last_fired_at, :utc_datetime

    belongs_to :repository, Repository

    timestamps(type: :utc_datetime)
  end
end