Change primary key for tx actions

pull/6582/head
POA 2 years ago
parent dfb8c859a8
commit 2d466b7d68
  1. 5
      apps/explorer/lib/explorer/chain/transaction_actions.ex
  2. 7
      apps/explorer/priv/repo/migrations/20221104091552_add_transaction_actions_table.exs

@ -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

@ -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

Loading…
Cancel
Save