30 lines
795 B
Elixir
30 lines
795 B
Elixir
defmodule Odinsea.Database.Schema.DropData do
|
|
@moduledoc """
|
|
Ecto schema for the drop_data table.
|
|
Represents monster drop tables.
|
|
"""
|
|
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
@primary_key {:id, :id, autogenerate: true}
|
|
|
|
schema "drop_data" do
|
|
field :dropperid, :integer
|
|
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
|
|
end
|
|
|
|
@doc """
|
|
Changeset for creating/updating drop data.
|
|
"""
|
|
def changeset(drop_data, attrs) do
|
|
drop_data
|
|
|> cast(attrs, [:dropperid, :itemid, :minimum_quantity, :maximum_quantity, :questid, :chance])
|
|
|> validate_required([:dropperid, :itemid, :chance])
|
|
end
|
|
end
|