Files
odinsea-elixir/lib/odinsea/database/schema/drop_data_global.ex
2026-02-14 23:58:01 -07:00

32 lines
985 B
Elixir

defmodule Odinsea.Database.Schema.DropDataGlobal do
@moduledoc """
Ecto schema for the drop_data_global table.
Represents global drops that apply to all monsters in a continent.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :id, autogenerate: true}
schema "drop_data_global" do
field :continent, :integer
field :drop_type, :integer, default: 0, source: :dropType
field :itemid, :integer, default: 0
field :minimum_quantity, :integer, default: 1
field :maximum_quantity, :integer, default: 1
field :questid, :integer, default: 0
field :chance, :integer, default: 0
field :comments, :string
end
@doc """
Changeset for creating/updating global drop data.
"""
def changeset(drop_data_global, attrs) do
drop_data_global
|> cast(attrs, [:continent, :drop_type, :itemid, :minimum_quantity, :maximum_quantity, :questid, :chance, :comments])
|> validate_required([:continent, :itemid, :chance])
end
end