Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
blockscout/apps/explorer/priv/repo/migrations/20180717204948_create_balan...

27 lines
796 B

defmodule Explorer.Repo.Migrations.CreateBalances do
use Ecto.Migration
def change do
create table(:balances, primary_key: false) do
add(:address_hash, references(:addresses, column: :hash, type: :bytea), null: false)
add(:block_number, :bigint, null: false)
# null until fetched
add(:value, :numeric, precision: 100, default: fragment("NULL"), null: true)
add(:value_fetched_at, :utc_datetime, default: fragment("NULL"), null: true)
timestamps(null: false, type: :utc_datetime)
end
create(unique_index(:balances, [:address_hash, :block_number]))
create(
unique_index(
:balances,
[:address_hash, :block_number],
name: :unfetched_balances,
where: "value_fetched_at IS NULL"
)
)
end
end