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

28 lines
712 B
Elixir

defmodule Odinsea.Database.Schema.TournamentLog do
@moduledoc """
Ecto schema for the tournamentlog table.
Represents tournament records.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key {:logid, :id, autogenerate: true}
@timestamps_opts [inserted_at: :when, updated_at: false]
schema "tournamentlog" do
field :winnerid, :integer, default: 0
field :num_contestants, :integer, default: 0, source: :numContestants
field :when, :naive_datetime
end
@doc """
Changeset for creating a tournament log entry.
"""
def changeset(tournament_log, attrs) do
tournament_log
|> cast(attrs, [:winnerid, :num_contestants])
|> validate_required([:winnerid])
end
end