From d563a2568adf987ccba5efb5a8742dc8e7c17071 Mon Sep 17 00:00:00 2001 From: Gustavo Santos Ferreira Date: Fri, 14 Dec 2018 15:30:24 -0200 Subject: [PATCH] add metadata column to address_names --- apps/explorer/lib/explorer/chain/address/name.ex | 6 ++++-- ...0181213111656_add_metadata_field_to_address_names.exs | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 apps/explorer/priv/repo/migrations/20181213111656_add_metadata_field_to_address_names.exs 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