port over some more
This commit is contained in:
30
lib/odinsea/database/schema/trock_location.ex
Normal file
30
lib/odinsea/database/schema/trock_location.ex
Normal file
@@ -0,0 +1,30 @@
|
||||
defmodule Odinsea.Database.Schema.TrockLocation do
|
||||
@moduledoc """
|
||||
Ecto schema for the trocklocations table.
|
||||
Represents teleport rock locations for characters.
|
||||
"""
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:trockid, :id, autogenerate: true}
|
||||
|
||||
schema "trocklocations" 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 teleport rock location.
|
||||
"""
|
||||
def changeset(trock_location, attrs) do
|
||||
trock_location
|
||||
|> cast(attrs, [:characterid, :mapid])
|
||||
|> validate_required([:characterid, :mapid])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user