change migration order

pull/2895/head
Ayrat Badykov 5 years ago
parent 3dd80bb9b9
commit 3ed0e82d24
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 4
      apps/explorer/priv/repo/migrations/20191121064805_add_block_hash_and_block_index_to_logs.exs

@ -7,8 +7,6 @@ defmodule Explorer.Repo.Migrations.AddBlockHashAndBlockIndexToLogs do
add(:block_number, :integer) add(:block_number, :integer)
end end
create(index(:logs, [:block_number]))
execute(""" execute("""
UPDATE logs log UPDATE logs log
SET block_hash = with_block.block_hash, SET block_hash = with_block.block_hash,
@ -25,6 +23,8 @@ defmodule Explorer.Repo.Migrations.AddBlockHashAndBlockIndexToLogs do
; ;
""") """)
create(index(:logs, [:block_number]))
alter table(:logs) do alter table(:logs) do
modify(:block_hash, references(:blocks, column: :hash, type: :bytea), null: false) modify(:block_hash, references(:blocks, column: :hash, type: :bytea), null: false)
end end

Loading…
Cancel
Save