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/20181107164103_eip6.exs

37 lines
1.0 KiB

defmodule Explorer.Repo.Migrations.EIP6 do
use Ecto.Migration
def up do
execute("ALTER TABLE internal_transactions DROP CONSTRAINT suicide_has_from_and_to_address_hashes")
execute("UPDATE internal_transactions SET type = 'selfdestruct' WHERE type = 'suicide'")
create(
constraint(
:internal_transactions,
:selfdestruct_has_from_and_to_address_hashes,
check: """
type != 'selfdestruct' OR
(from_address_hash IS NOT NULL AND gas IS NULL AND to_address_hash IS NOT NULL)
"""
)
)
end
def down do
execute("ALTER TABLE internal_transactions DROP CONSTRAINT selfdestruct_has_from_and_to_address_hashes")
execute("UPDATE internal_transactions SET type = 'suicide' WHERE type = 'selfdestruct'")
create(
constraint(
:internal_transactions,
:suicide_has_from_and_to_address_hashes,
check: """
type != 'suicide' OR
(from_address_hash IS NOT NULL AND gas IS NULL AND to_address_hash IS NOT NULL)
"""
)
)
end
end