|
|
@ -20,20 +20,22 @@ defmodule Explorer.Chain.Address.Name do |
|
|
|
address: %Ecto.Association.NotLoaded{} | Address.t(), |
|
|
|
address: %Ecto.Association.NotLoaded{} | Address.t(), |
|
|
|
address_hash: Hash.Address.t(), |
|
|
|
address_hash: Hash.Address.t(), |
|
|
|
name: String.t(), |
|
|
|
name: String.t(), |
|
|
|
primary: boolean() |
|
|
|
primary: boolean(), |
|
|
|
|
|
|
|
metadata: map() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@primary_key false |
|
|
|
@primary_key false |
|
|
|
schema "address_names" do |
|
|
|
schema "address_names" do |
|
|
|
field(:name, :string) |
|
|
|
field(:name, :string) |
|
|
|
field(:primary, :boolean) |
|
|
|
field(:primary, :boolean) |
|
|
|
|
|
|
|
field(:metadata, :map) |
|
|
|
belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) |
|
|
|
belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) |
|
|
|
|
|
|
|
|
|
|
|
timestamps() |
|
|
|
timestamps() |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@required_fields ~w(address_hash name)a |
|
|
|
@required_fields ~w(address_hash name)a |
|
|
|
@optional_fields ~w(primary)a |
|
|
|
@optional_fields ~w(primary metadata)a |
|
|
|
@allowed_fields @required_fields ++ @optional_fields |
|
|
|
@allowed_fields @required_fields ++ @optional_fields |
|
|
|
|
|
|
|
|
|
|
|
def changeset(%__MODULE__{} = struct, params \\ %{}) do |
|
|
|
def changeset(%__MODULE__{} = struct, params \\ %{}) do |
|
|
|