diff --git a/apps/explorer/lib/explorer/chain/address/name.ex b/apps/explorer/lib/explorer/chain/address/name.ex index f2a6489375..926e15ef13 100644 --- a/apps/explorer/lib/explorer/chain/address/name.ex +++ b/apps/explorer/lib/explorer/chain/address/name.ex @@ -20,20 +20,22 @@ defmodule Explorer.Chain.Address.Name do address: %Ecto.Association.NotLoaded{} | Address.t(), address_hash: Hash.Address.t(), name: String.t(), - primary: boolean() + primary: boolean(), + metadata: map() } @primary_key false schema "address_names" do field(:name, :string) field(:primary, :boolean) + field(:metadata, :map) belongs_to(:address, Address, foreign_key: :address_hash, references: :hash, type: Hash.Address) timestamps() end @required_fields ~w(address_hash name)a - @optional_fields ~w(primary)a + @optional_fields ~w(primary metadata)a @allowed_fields @required_fields ++ @optional_fields def changeset(%__MODULE__{} = struct, params \\ %{}) do diff --git a/apps/explorer/priv/repo/migrations/20181213111656_add_metadata_field_to_address_names.exs b/apps/explorer/priv/repo/migrations/20181213111656_add_metadata_field_to_address_names.exs new file mode 100644 index 0000000000..593c381a29 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20181213111656_add_metadata_field_to_address_names.exs @@ -0,0 +1,9 @@ +defmodule Explorer.Repo.Migrations.AddMetadataFieldToAddressNames do + use Ecto.Migration + + def change do + alter table(:address_names) do + add(:metadata, :map) + end + end +end