add metadata column to address_names

gsf-validator-metadata
Gustavo Santos Ferreira 6 years ago
parent ced1bd109f
commit d563a2568a
  1. 6
      apps/explorer/lib/explorer/chain/address/name.ex
  2. 9
      apps/explorer/priv/repo/migrations/20181213111656_add_metadata_field_to_address_names.exs

@ -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

@ -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
Loading…
Cancel
Save