fix: Add compatibility with current frontend for some public props (#10998)
* fix: Fix renaming of public props * Fix sanitize_duplicated_log_index_logs_test.exs --------- Co-authored-by: Nikita Pozdniakov <nikitosing4@mail.ru>pull/11000/head
parent
26d906a5cc
commit
6319514bcf
@ -1,116 +0,0 @@ |
||||
defmodule Mix.Tasks.Encrypt do |
||||
@moduledoc "The encrypt mix task: `mix help encrypt`" |
||||
use Mix.Task |
||||
|
||||
alias Ecto.Changeset |
||||
|
||||
alias Explorer.Account.{ |
||||
CustomABI, |
||||
Identity, |
||||
PublicTagsRequest, |
||||
TagAddress, |
||||
TagTransaction, |
||||
WatchlistAddress, |
||||
WatchlistNotification |
||||
} |
||||
|
||||
alias Explorer.Repo.Account |
||||
alias Mix.Task |
||||
|
||||
@shortdoc "Encrypt" |
||||
def run(_) do |
||||
Task.run("app.start") |
||||
|
||||
Identity |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_uid: element.uid, |
||||
encrypted_email: element.email, |
||||
encrypted_name: element.name, |
||||
encrypted_nickname: element.nickname, |
||||
encrypted_avatar: element.avatar, |
||||
uid_hash: element.uid |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
|
||||
TagAddress |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_name: element.name, |
||||
encrypted_address_hash: element.address_hash, |
||||
address_hash_hash: element.address_hash |> to_string() |> String.downcase() |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
|
||||
TagTransaction |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_name: element.name, |
||||
encrypted_transaction_hash: element.transaction_hash, |
||||
transaction_hash_hash: element.transaction_hash |> to_string() |> String.downcase() |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
|
||||
CustomABI |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_name: element.name, |
||||
encrypted_address_hash: element.address_hash, |
||||
address_hash_hash: element.address_hash |> to_string() |> String.downcase() |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
|
||||
WatchlistAddress |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_name: element.name, |
||||
encrypted_address_hash: element.address_hash, |
||||
address_hash_hash: element.address_hash |> to_string() |> String.downcase() |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
|
||||
WatchlistNotification |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_name: element.name, |
||||
encrypted_from_address_hash: element.from_address_hash, |
||||
encrypted_to_address_hash: element.to_address_hash, |
||||
encrypted_transaction_hash: element.transaction_hash, |
||||
encrypted_subject: element.subject, |
||||
from_address_hash_hash: element.from_address_hash |> to_string() |> String.downcase(), |
||||
to_address_hash_hash: element.to_address_hash |> to_string() |> String.downcase(), |
||||
transaction_hash_hash: element.transaction_hash |> to_string() |> String.downcase(), |
||||
subject_hash: element.subject |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
|
||||
PublicTagsRequest |
||||
|> Account.all() |
||||
|> Enum.each(fn element -> |
||||
element |
||||
|> Changeset.change(%{ |
||||
encrypted_full_name: element.full_name, |
||||
encrypted_email: element.email |
||||
}) |
||||
|> Account.update!() |
||||
end) |
||||
end |
||||
end |
@ -0,0 +1,30 @@ |
||||
defmodule Explorer.Repo.Migrations.AddAuxTypesForDuplicatedLogIndexLogsMigration do |
||||
use Ecto.Migration |
||||
|
||||
def up do |
||||
execute(""" |
||||
CREATE TYPE log_id AS ( |
||||
transaction_hash bytea, |
||||
block_hash bytea, |
||||
log_index integer |
||||
); |
||||
""") |
||||
|
||||
execute(""" |
||||
CREATE TYPE nft_id AS ( |
||||
block_number bigint, |
||||
log_index integer |
||||
); |
||||
""") |
||||
end |
||||
|
||||
def down do |
||||
execute(""" |
||||
DROP TYPE log_id; |
||||
""") |
||||
|
||||
execute(""" |
||||
DROP TYPE nft_id; |
||||
""") |
||||
end |
||||
end |
Loading…
Reference in new issue