From 3ed0e82d245f0b4b05eb0a0da25cc58d179810ac Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 28 Nov 2019 10:26:25 +0300 Subject: [PATCH] change migration order --- .../20191121064805_add_block_hash_and_block_index_to_logs.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/explorer/priv/repo/migrations/20191121064805_add_block_hash_and_block_index_to_logs.exs b/apps/explorer/priv/repo/migrations/20191121064805_add_block_hash_and_block_index_to_logs.exs index 4771653646..bd6d392e5a 100644 --- a/apps/explorer/priv/repo/migrations/20191121064805_add_block_hash_and_block_index_to_logs.exs +++ b/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) end - create(index(:logs, [:block_number])) - execute(""" UPDATE logs log 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 modify(:block_hash, references(:blocks, column: :hash, type: :bytea), null: false) end