Files
odinsea-elixir/lib/odinsea/database/schema/speedrun.ex
2026-02-14 23:58:01 -07:00

29 lines
674 B
Elixir

defmodule Odinsea.Database.Schema.Speedrun do
@moduledoc """
Ecto schema for the speedruns table.
Represents dungeon speedrun records.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :id, autogenerate: true}
schema "speedruns" do
field :type, :string
field :leader, :string
field :timestring, :string
field :time, :integer, default: 0
field :members, :string, default: ""
end
@doc """
Changeset for creating a speedrun record.
"""
def changeset(speedrun, attrs) do
speedrun
|> cast(attrs, [:type, :leader, :timestring, :time, :members])
|> validate_required([:type, :leader, :timestring])
end
end