diff --git a/apps/explorer/lib/explorer/chain/transaction_actions.ex b/apps/explorer/lib/explorer/chain/transaction_actions.ex index 42593b9f0f..fa0c7aa273 100644 --- a/apps/explorer/lib/explorer/chain/transaction_actions.ex +++ b/apps/explorer/lib/explorer/chain/transaction_actions.ex @@ -26,6 +26,7 @@ defmodule Explorer.Chain.TransactionActions do log_index: non_neg_integer() } + @primary_key false schema "transaction_actions" do field(:protocol, Ecto.Enum, values: @supported_protocols) field(:data, :map) @@ -49,9 +50,9 @@ defmodule Explorer.Chain.TransactionActions do ] ) - field(:log_index, :integer) + field(:log_index, :integer, primary_key: true) - belongs_to(:transaction, Transaction, foreign_key: :hash, references: :hash, type: Hash.Full) + belongs_to(:transaction, Transaction, foreign_key: :hash, primary_key: true, references: :hash, type: Hash.Full) timestamps() end diff --git a/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs b/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs index 845fd381c6..90d172cea5 100644 --- a/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs +++ b/apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs @@ -12,15 +12,16 @@ defmodule Explorer.Repo.Migrations.AddTransactionActionsTable do "DROP TYPE transaction_actions_type" ) - create table(:transaction_actions) do + create table(:transaction_actions, primary_key: false) do add(:hash, references(:transactions, column: :hash, on_delete: :delete_all, on_update: :update_all, type: :bytea), - null: false + null: false, + primary_key: true ) add(:protocol, :transaction_actions_protocol, null: false) add(:data, :map, default: %{}, null: false) add(:type, :transaction_actions_type, null: false) - add(:log_index, :integer, null: false) + add(:log_index, :integer, null: false, primary_key: true) timestamps(null: false, type: :utc_datetime_usec) end