port over some more
This commit is contained in:
27
lib/odinsea/database/schema/battle_log.ex
Normal file
27
lib/odinsea/database/schema/battle_log.ex
Normal file
@@ -0,0 +1,27 @@
|
||||
defmodule Odinsea.Database.Schema.BattleLog do
|
||||
@moduledoc """
|
||||
Ecto schema for the battlelog table.
|
||||
Represents PvP battle records between accounts.
|
||||
"""
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:battlelogid, :id, autogenerate: true}
|
||||
@timestamps_opts [inserted_at: :when, updated_at: false]
|
||||
|
||||
schema "battlelog" do
|
||||
field :accid, :integer, default: 0
|
||||
field :accid_to, :integer, default: 0
|
||||
field :when, :naive_datetime
|
||||
end
|
||||
|
||||
@doc """
|
||||
Changeset for creating a battle log entry.
|
||||
"""
|
||||
def changeset(battle_log, attrs) do
|
||||
battle_log
|
||||
|> cast(attrs, [:accid, :accid_to])
|
||||
|> validate_required([:accid, :accid_to])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user