port over some more
This commit is contained in:
28
lib/odinsea/database/schema/gm_log.ex
Normal file
28
lib/odinsea/database/schema/gm_log.ex
Normal file
@@ -0,0 +1,28 @@
|
||||
defmodule Odinsea.Database.Schema.GmLog do
|
||||
@moduledoc """
|
||||
Ecto schema for the gmlog table.
|
||||
Represents GM command usage logs.
|
||||
"""
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:gmlogid, :id, autogenerate: true}
|
||||
@timestamps_opts [inserted_at: :time, updated_at: false]
|
||||
|
||||
schema "gmlog" do
|
||||
field :cid, :integer, default: 0
|
||||
field :command, :string
|
||||
field :mapid, :integer, default: 0
|
||||
field :time, :naive_datetime
|
||||
end
|
||||
|
||||
@doc """
|
||||
Changeset for creating a GM log entry.
|
||||
"""
|
||||
def changeset(gm_log, attrs) do
|
||||
gm_log
|
||||
|> cast(attrs, [:cid, :command, :mapid])
|
||||
|> validate_required([:cid, :command])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user