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/20180117221922_create_block...

29 lines
949 B

defmodule Explorer.Repo.Migrations.CreateBlocks do
use Ecto.Migration
def change do
create table(:blocks, primary_key: false) do
add(:difficulty, :numeric, precision: 50)
add(:gas_limit, :integer, null: false)
add(:gas_used, :integer, null: false)
add(:hash, :bytea, null: false, primary_key: true)
add(:miner_hash, references(:addresses, column: :hash, type: :bytea), null: false)
add(:nonce, :bytea, null: false)
add(:number, :bigint, null: false)
# not a foreign key to allow skipped blocks
add(:parent_hash, :bytea, null: false)
add(:size, :integer, null: false)
add(:timestamp, :utc_datetime, null: false)
add(:total_difficulty, :numeric, precision: 50)
timestamps(null: false, type: :utc_datetime)
end
create(index(:blocks, [:timestamp]))
create(unique_index(:blocks, [:parent_hash]))
create(unique_index(:blocks, [:number]))
end
end