Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blockscout/lib/explorer/credit.ex

27 lines
610 B

defmodule Explorer.Credit do
@moduledoc """
A materialized view representing the credits to an address.
"""
use Ecto.Schema
alias Ecto.Adapters.SQL
alias Explorer.Address
alias Explorer.Repo
@timestamps_opts [type: Timex.Ecto.DateTime,
autogenerate: {Timex.Ecto.DateTime, :autogenerate, []}]
@primary_key false
schema "credits" do
belongs_to :address, Address, primary_key: true
field :value, :decimal
field :count, :integer
timestamps()
end
def refresh do
SQL.query!(Repo, "REFRESH MATERIALIZED VIEW CONCURRENTLY credits;", [])
end
end