573 B · text 5af55d9
defmodule GitGud.Workflows.WorkflowArtifact do
use Ecto.Schema
import Ecto.Changeset
alias GitGud.Workflows.WorkflowRun
schema "workflow_artifacts" do
field :name, :string
field :size, :integer, default: 0
field :content_type, :string
field :storage_key, :string
belongs_to :workflow_run, WorkflowRun
timestamps(type: :utc_datetime)
end
def changeset(a, attrs) do
a
|> cast(attrs, [:name, :size, :content_type, :storage_key])
|> validate_required([:name, :storage_key])
|> validate_length(:name, max: 255)
end
end