port over some more
This commit is contained in:
27
lib/odinsea/database/schema/tournament_log.ex
Normal file
27
lib/odinsea/database/schema/tournament_log.ex
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
Reference in New Issue
Block a user