Current section

Files

Jump to
gust lib gust flows dag.ex
Raw

lib/gust/flows/dag.ex

defmodule Gust.Flows.Dag do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
schema "dags" do
field :name, :string
field :enabled, :boolean, default: true
has_many :runs, Gust.Flows.Run
timestamps(type: :utc_datetime)
end
@doc false
def changeset(dag, attrs) do
dag
|> cast(attrs, [:name, :enabled])
|> validate_required([:name])
|> validate_format(:name, ~r/^[a-z0-9_]+$/,
message: "must be lowercase, no spaces, only letters, numbers, and underscores"
)
|> unique_constraint(:name)
end
end