31 lines
774 B
Elixir
31 lines
774 B
Elixir
defmodule Odinsea.Database.Schema.RegrockLocation do
|
|
@moduledoc """
|
|
Ecto schema for the regrocklocations table.
|
|
Represents regular teleport rock locations for characters.
|
|
"""
|
|
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
@primary_key {:trockid, :id, autogenerate: true}
|
|
|
|
schema "regrocklocations" do
|
|
field :characterid, :integer
|
|
field :mapid, :integer
|
|
|
|
belongs_to :character, Odinsea.Database.Schema.Character,
|
|
foreign_key: :characterid,
|
|
references: :id,
|
|
define_field: false
|
|
end
|
|
|
|
@doc """
|
|
Changeset for creating/updating a regular teleport rock location.
|
|
"""
|
|
def changeset(regrock_location, attrs) do
|
|
regrock_location
|
|
|> cast(attrs, [:characterid, :mapid])
|
|
|> validate_required([:characterid, :mapid])
|
|
end
|
|
end
|