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