2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
-- PostgreSQL database dump
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
-- Dumped from database version 14.12
|
|
|
|
-- Dumped by pg_dump version 14.12
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
SET statement_timeout = 0;
|
|
|
|
SET lock_timeout = 0;
|
|
|
|
SET idle_in_transaction_session_timeout = 0;
|
|
|
|
SET client_encoding = 'UTF8';
|
|
|
|
SET standard_conforming_strings = on;
|
|
|
|
SELECT pg_catalog.set_config('search_path', '', false);
|
|
|
|
SET check_function_bodies = false;
|
|
|
|
SET xmloption = content;
|
|
|
|
SET client_min_messages = warning;
|
|
|
|
SET row_security = off;
|
|
|
|
|
2022-08-15 16:15:48 +00:00
|
|
|
--
|
|
|
|
-- Name: timescaledb; Type: EXTENSION; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE EXTENSION IF NOT EXISTS timescaledb WITH SCHEMA public;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: EXTENSION timescaledb; Type: COMMENT; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-07-18 17:29:27 +00:00
|
|
|
COMMENT ON EXTENSION timescaledb IS 'Enables scalable inserts and complex queries for time-series data (Community Edition)';
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
-- Name: eth; Type: SCHEMA; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SCHEMA eth;
|
|
|
|
|
|
|
|
|
2022-03-17 13:32:05 +00:00
|
|
|
--
|
|
|
|
-- Name: eth_meta; Type: SCHEMA; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SCHEMA eth_meta;
|
|
|
|
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
--
|
|
|
|
-- Name: ipld; Type: SCHEMA; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SCHEMA ipld;
|
|
|
|
|
|
|
|
|
2022-03-28 23:23:05 +00:00
|
|
|
--
|
2022-08-15 16:15:48 +00:00
|
|
|
-- Name: canonical_header_hash(bigint); Type: FUNCTION; Schema: public; Owner: -
|
2022-03-28 23:23:05 +00:00
|
|
|
--
|
|
|
|
|
2022-08-15 16:15:48 +00:00
|
|
|
CREATE FUNCTION public.canonical_header_hash(height bigint) RETURNS character varying
|
2023-07-18 17:29:27 +00:00
|
|
|
LANGUAGE sql
|
2022-08-15 16:15:48 +00:00
|
|
|
AS $$
|
2023-07-18 17:29:27 +00:00
|
|
|
SELECT block_hash from eth.header_cids WHERE block_number = height AND canonical = true LIMIT 1;
|
2022-08-15 16:15:48 +00:00
|
|
|
$$;
|
2022-03-28 23:23:05 +00:00
|
|
|
|
|
|
|
|
2023-03-08 00:17:35 +00:00
|
|
|
--
|
|
|
|
-- Name: get_storage_at_by_hash(text, text, text); Type: FUNCTION; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-03-08 02:00:01 +00:00
|
|
|
CREATE FUNCTION public.get_storage_at_by_hash(v_state_leaf_key text, v_storage_leaf_key text, v_block_hash text) RETURNS TABLE(cid text, val bytea, block_number bigint, removed boolean, state_leaf_removed boolean)
|
2023-03-08 00:17:35 +00:00
|
|
|
LANGUAGE plpgsql
|
|
|
|
AS $$
|
|
|
|
DECLARE
|
|
|
|
v_block_no BIGINT;
|
|
|
|
BEGIN
|
|
|
|
SELECT h.block_number INTO v_block_no FROM eth.header_cids AS h WHERE block_hash = v_block_hash LIMIT 1;
|
|
|
|
IF v_block_no IS NULL THEN
|
|
|
|
RETURN;
|
|
|
|
END IF;
|
|
|
|
RETURN QUERY SELECT * FROM get_storage_at_by_number(v_state_leaf_key, v_storage_leaf_key, v_block_no);
|
|
|
|
END
|
|
|
|
$$;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: get_storage_at_by_number(text, text, bigint); Type: FUNCTION; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-03-08 00:31:26 +00:00
|
|
|
CREATE FUNCTION public.get_storage_at_by_number(v_state_leaf_key text, v_storage_leaf_key text, v_block_no bigint) RETURNS TABLE(cid text, val bytea, block_number bigint, removed boolean, state_leaf_removed boolean)
|
2023-03-08 00:17:35 +00:00
|
|
|
LANGUAGE plpgsql
|
|
|
|
AS $$
|
|
|
|
DECLARE
|
|
|
|
v_state_path BYTEA;
|
|
|
|
v_header TEXT;
|
|
|
|
v_canonical_header TEXT;
|
|
|
|
BEGIN
|
|
|
|
CREATE TEMP TABLE tmp_tt_stg2
|
|
|
|
(
|
|
|
|
header_id TEXT,
|
|
|
|
cid TEXT,
|
2023-03-08 00:31:26 +00:00
|
|
|
val BYTEA,
|
2023-03-08 00:17:35 +00:00
|
|
|
block_number BIGINT,
|
|
|
|
removed BOOL,
|
|
|
|
state_leaf_removed BOOL
|
|
|
|
) ON COMMIT DROP;
|
|
|
|
-- in best case scenario, the latest record we find for the provided keys is for a canonical block
|
|
|
|
INSERT INTO tmp_tt_stg2
|
|
|
|
SELECT storage_cids.header_id,
|
|
|
|
storage_cids.cid,
|
2023-03-08 00:31:26 +00:00
|
|
|
storage_cids.val,
|
2023-03-08 00:17:35 +00:00
|
|
|
storage_cids.block_number,
|
|
|
|
storage_cids.removed,
|
|
|
|
was_state_leaf_removed_by_number(v_state_leaf_key, v_block_no) AS state_leaf_removed
|
|
|
|
FROM eth.storage_cids
|
|
|
|
WHERE storage_leaf_key = v_storage_leaf_key
|
|
|
|
AND storage_cids.state_leaf_key = v_state_leaf_key -- can lookup directly on the leaf key in v5
|
|
|
|
AND storage_cids.block_number <= v_block_no
|
|
|
|
ORDER BY storage_cids.block_number DESC LIMIT 1;
|
|
|
|
-- check if result is from canonical state
|
2023-03-08 18:42:02 +00:00
|
|
|
SELECT header_id, canonical_header_hash(tmp_tt_stg2.block_number)
|
|
|
|
INTO v_header, v_canonical_header
|
2023-03-08 00:17:35 +00:00
|
|
|
FROM tmp_tt_stg2 LIMIT 1;
|
|
|
|
IF v_header IS NULL OR v_header != v_canonical_header THEN
|
|
|
|
RAISE NOTICE 'get_storage_at_by_number: chosen header NULL OR % != canonical header % for block number %, trying again.', v_header, v_canonical_header, v_block_no;
|
|
|
|
TRUNCATE tmp_tt_stg2;
|
|
|
|
-- If we hit on a non-canonical block, we need to go back and do a comprehensive check.
|
2023-03-08 17:10:23 +00:00
|
|
|
-- We try to avoid this to avoid joining between storage_cids and header_cids
|
2023-03-08 00:17:35 +00:00
|
|
|
INSERT INTO tmp_tt_stg2
|
|
|
|
SELECT storage_cids.header_id,
|
|
|
|
storage_cids.cid,
|
2023-03-08 00:31:26 +00:00
|
|
|
storage_cids.val,
|
2023-03-08 00:17:35 +00:00
|
|
|
storage_cids.block_number,
|
|
|
|
storage_cids.removed,
|
|
|
|
was_state_leaf_removed_by_number(
|
|
|
|
v_state_leaf_key,
|
|
|
|
v_block_no
|
|
|
|
) AS state_leaf_removed
|
|
|
|
FROM eth.storage_cids
|
|
|
|
INNER JOIN eth.header_cids ON (
|
2023-03-08 17:10:23 +00:00
|
|
|
storage_cids.header_id = header_cids.block_hash
|
|
|
|
AND storage_cids.block_number = header_cids.block_number
|
2023-03-08 00:17:35 +00:00
|
|
|
)
|
|
|
|
WHERE state_leaf_key = v_state_leaf_key
|
|
|
|
AND storage_leaf_key = v_storage_leaf_key
|
|
|
|
AND storage_cids.block_number <= v_block_no
|
|
|
|
AND header_cids.block_number <= v_block_no
|
|
|
|
AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number))
|
|
|
|
ORDER BY header_cids.block_number DESC LIMIT 1;
|
|
|
|
END IF;
|
2023-03-08 00:31:26 +00:00
|
|
|
RETURN QUERY SELECT t.cid, t.val, t.block_number, t.removed, t.state_leaf_removed
|
2023-03-08 02:00:01 +00:00
|
|
|
FROM tmp_tt_stg2 AS t LIMIT 1;
|
2023-03-08 00:17:35 +00:00
|
|
|
END
|
|
|
|
$$;
|
|
|
|
|
|
|
|
|
2022-08-15 16:15:48 +00:00
|
|
|
--
|
|
|
|
-- Name: was_state_leaf_removed(character varying, character varying); Type: FUNCTION; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-03-08 00:17:35 +00:00
|
|
|
CREATE FUNCTION public.was_state_leaf_removed(v_key character varying, v_hash character varying) RETURNS boolean
|
2022-08-15 16:15:48 +00:00
|
|
|
LANGUAGE sql
|
|
|
|
AS $$
|
2023-02-02 01:56:57 +00:00
|
|
|
SELECT state_cids.removed = true
|
2022-08-15 16:15:48 +00:00
|
|
|
FROM eth.state_cids
|
|
|
|
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
2023-03-08 00:17:35 +00:00
|
|
|
WHERE state_leaf_key = v_key
|
2022-08-15 16:15:48 +00:00
|
|
|
AND state_cids.block_number <= (SELECT block_number
|
|
|
|
FROM eth.header_cids
|
2023-03-08 00:17:35 +00:00
|
|
|
WHERE block_hash = v_hash)
|
|
|
|
ORDER BY state_cids.block_number DESC LIMIT 1;
|
|
|
|
$$;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: was_state_leaf_removed_by_number(character varying, bigint); Type: FUNCTION; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE FUNCTION public.was_state_leaf_removed_by_number(v_key character varying, v_block_no bigint) RETURNS boolean
|
|
|
|
LANGUAGE sql
|
|
|
|
AS $$
|
|
|
|
SELECT state_cids.removed = true
|
|
|
|
FROM eth.state_cids
|
|
|
|
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
|
|
|
|
WHERE state_leaf_key = v_key
|
|
|
|
AND state_cids.block_number <= v_block_no
|
2022-08-15 16:15:48 +00:00
|
|
|
ORDER BY state_cids.block_number DESC LIMIT 1;
|
|
|
|
$$;
|
|
|
|
|
|
|
|
|
2023-05-15 06:17:32 +00:00
|
|
|
SET default_tablespace = '';
|
|
|
|
|
|
|
|
SET default_table_access_method = heap;
|
|
|
|
|
2024-07-25 11:16:19 +00:00
|
|
|
--
|
|
|
|
-- Name: blob_hashes; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.blob_hashes (
|
|
|
|
tx_hash character varying(66) NOT NULL,
|
|
|
|
index integer NOT NULL,
|
|
|
|
blob_hash bytea NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2023-05-15 06:17:32 +00:00
|
|
|
--
|
|
|
|
-- Name: header_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.header_cids (
|
|
|
|
block_number bigint NOT NULL,
|
|
|
|
block_hash character varying(66) NOT NULL,
|
|
|
|
parent_hash character varying(66) NOT NULL,
|
|
|
|
cid text NOT NULL,
|
|
|
|
td numeric NOT NULL,
|
|
|
|
node_ids character varying(128)[] NOT NULL,
|
|
|
|
reward numeric NOT NULL,
|
|
|
|
state_root character varying(66) NOT NULL,
|
|
|
|
tx_root character varying(66) NOT NULL,
|
|
|
|
receipt_root character varying(66) NOT NULL,
|
|
|
|
uncles_hash character varying(66) NOT NULL,
|
|
|
|
bloom bytea NOT NULL,
|
|
|
|
"timestamp" bigint NOT NULL,
|
2023-07-18 17:29:27 +00:00
|
|
|
coinbase character varying(66) NOT NULL,
|
2024-06-28 12:36:18 +00:00
|
|
|
canonical boolean DEFAULT true NOT NULL,
|
|
|
|
withdrawals_root character varying(66) NOT NULL
|
2023-05-15 06:17:32 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: TABLE header_cids; Type: COMMENT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON TABLE eth.header_cids IS '@name EthHeaderCids';
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: COLUMN header_cids.node_ids; Type: COMMENT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON COLUMN eth.header_cids.node_ids IS '@name EthNodeIDs';
|
|
|
|
|
|
|
|
|
2021-09-10 18:51:47 +00:00
|
|
|
--
|
|
|
|
-- Name: log_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.log_cids (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2022-08-08 16:08:09 +00:00
|
|
|
header_id character varying(66) NOT NULL,
|
2023-02-09 00:35:16 +00:00
|
|
|
cid text NOT NULL,
|
2021-11-25 17:33:06 +00:00
|
|
|
rct_id character varying(66) NOT NULL,
|
2021-09-30 12:39:48 +00:00
|
|
|
address character varying(66) NOT NULL,
|
2021-09-10 18:51:47 +00:00
|
|
|
index integer NOT NULL,
|
|
|
|
topic0 character varying(66),
|
|
|
|
topic1 character varying(66),
|
|
|
|
topic2 character varying(66),
|
2023-02-09 00:35:16 +00:00
|
|
|
topic3 character varying(66)
|
2021-09-10 18:51:47 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
-- Name: receipt_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.receipt_cids (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2022-08-08 16:08:09 +00:00
|
|
|
header_id character varying(66) NOT NULL,
|
2021-11-15 00:06:02 +00:00
|
|
|
tx_id character varying(66) NOT NULL,
|
2023-02-09 00:35:16 +00:00
|
|
|
cid text NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
contract character varying(66),
|
|
|
|
post_state character varying(66),
|
2023-02-09 00:35:16 +00:00
|
|
|
post_status smallint
|
2021-08-29 18:55:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: state_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.state_cids (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2021-11-15 00:06:02 +00:00
|
|
|
header_id character varying(66) NOT NULL,
|
2023-02-02 01:56:57 +00:00
|
|
|
state_leaf_key character varying(66) NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
cid text NOT NULL,
|
2021-11-25 17:33:06 +00:00
|
|
|
diff boolean DEFAULT false NOT NULL,
|
2023-02-02 01:56:57 +00:00
|
|
|
balance numeric,
|
|
|
|
nonce bigint,
|
|
|
|
code_hash character varying(66),
|
|
|
|
storage_root character varying(66),
|
|
|
|
removed boolean NOT NULL
|
2021-08-29 18:55:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: storage_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.storage_cids (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2021-11-15 00:06:02 +00:00
|
|
|
header_id character varying(66) NOT NULL,
|
2023-02-02 01:56:57 +00:00
|
|
|
state_leaf_key character varying(66) NOT NULL,
|
|
|
|
storage_leaf_key character varying(66) NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
cid text NOT NULL,
|
2021-11-25 17:33:06 +00:00
|
|
|
diff boolean DEFAULT false NOT NULL,
|
2023-02-02 01:56:57 +00:00
|
|
|
val bytea,
|
|
|
|
removed boolean NOT NULL
|
2021-08-29 18:55:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: transaction_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.transaction_cids (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2021-11-15 00:06:02 +00:00
|
|
|
header_id character varying(66) NOT NULL,
|
2021-11-25 17:33:06 +00:00
|
|
|
tx_hash character varying(66) NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
cid text NOT NULL,
|
2022-08-08 16:08:09 +00:00
|
|
|
dst character varying(66),
|
2021-08-29 18:55:44 +00:00
|
|
|
src character varying(66) NOT NULL,
|
2021-11-25 17:33:06 +00:00
|
|
|
index integer NOT NULL,
|
|
|
|
tx_type integer,
|
|
|
|
value numeric
|
2021-08-29 18:55:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: TABLE transaction_cids; Type: COMMENT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON TABLE eth.transaction_cids IS '@name EthTransactionCids';
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: uncle_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.uncle_cids (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
block_hash character varying(66) NOT NULL,
|
2021-11-15 00:06:02 +00:00
|
|
|
header_id character varying(66) NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
parent_hash character varying(66) NOT NULL,
|
|
|
|
cid text NOT NULL,
|
2023-02-10 16:38:31 +00:00
|
|
|
reward numeric NOT NULL,
|
|
|
|
index integer NOT NULL
|
2021-08-29 18:55:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
--
|
|
|
|
-- Name: withdrawal_cids; Type: TABLE; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth.withdrawal_cids (
|
|
|
|
block_number bigint NOT NULL,
|
|
|
|
header_id character varying(66) NOT NULL,
|
|
|
|
cid text NOT NULL,
|
|
|
|
index integer NOT NULL,
|
|
|
|
validator integer NOT NULL,
|
|
|
|
address character varying(66) NOT NULL,
|
|
|
|
amount numeric NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2022-03-17 13:32:05 +00:00
|
|
|
--
|
|
|
|
-- Name: watched_addresses; Type: TABLE; Schema: eth_meta; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE eth_meta.watched_addresses (
|
|
|
|
address character varying(66) NOT NULL,
|
|
|
|
created_at bigint NOT NULL,
|
|
|
|
watched_at bigint NOT NULL,
|
|
|
|
last_filled_at bigint DEFAULT 0 NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: blocks; Type: TABLE; Schema: ipld; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE TABLE ipld.blocks (
|
2022-03-15 21:06:13 +00:00
|
|
|
block_number bigint NOT NULL,
|
2021-08-29 18:55:44 +00:00
|
|
|
key text NOT NULL,
|
|
|
|
data bytea NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2021-12-27 17:33:26 +00:00
|
|
|
--
|
|
|
|
-- Name: db_version; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE public.db_version (
|
|
|
|
singleton boolean DEFAULT true NOT NULL,
|
|
|
|
version text NOT NULL,
|
2021-12-27 19:52:52 +00:00
|
|
|
tstamp timestamp without time zone DEFAULT now(),
|
2021-12-27 17:33:26 +00:00
|
|
|
CONSTRAINT db_version_singleton_check CHECK (singleton)
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
-- Name: goose_db_version; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE public.goose_db_version (
|
|
|
|
id integer NOT NULL,
|
|
|
|
version_id bigint NOT NULL,
|
|
|
|
is_applied boolean NOT NULL,
|
|
|
|
tstamp timestamp without time zone DEFAULT now()
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: goose_db_version_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.goose_db_version_id_seq
|
|
|
|
AS integer
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: goose_db_version_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER SEQUENCE public.goose_db_version_id_seq OWNED BY public.goose_db_version.id;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: nodes; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE public.nodes (
|
|
|
|
genesis_block character varying(66),
|
|
|
|
network_id character varying,
|
2021-11-18 13:33:22 +00:00
|
|
|
node_id character varying(128) NOT NULL,
|
2021-11-25 17:33:06 +00:00
|
|
|
client_name character varying,
|
2021-08-29 18:55:44 +00:00
|
|
|
chain_id integer DEFAULT 1
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: TABLE nodes; Type: COMMENT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON TABLE public.nodes IS '@name NodeInfo';
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: COLUMN nodes.node_id; Type: COMMENT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.nodes.node_id IS '@name ChainNodeID';
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: goose_db_version id; Type: DEFAULT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY public.goose_db_version ALTER COLUMN id SET DEFAULT nextval('public.goose_db_version_id_seq'::regclass);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: header_cids header_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.header_cids
|
2022-04-13 02:56:43 +00:00
|
|
|
ADD CONSTRAINT header_cids_pkey PRIMARY KEY (block_hash, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2021-09-10 18:51:47 +00:00
|
|
|
--
|
|
|
|
-- Name: log_cids log_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.log_cids
|
2022-08-08 16:08:09 +00:00
|
|
|
ADD CONSTRAINT log_cids_pkey PRIMARY KEY (rct_id, index, header_id, block_number);
|
2021-09-10 18:51:47 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
-- Name: receipt_cids receipt_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.receipt_cids
|
2022-08-08 16:08:09 +00:00
|
|
|
ADD CONSTRAINT receipt_cids_pkey PRIMARY KEY (tx_id, header_id, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: state_cids state_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.state_cids
|
2023-02-02 01:56:57 +00:00
|
|
|
ADD CONSTRAINT state_cids_pkey PRIMARY KEY (state_leaf_key, header_id, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: storage_cids storage_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.storage_cids
|
2023-02-02 01:56:57 +00:00
|
|
|
ADD CONSTRAINT storage_cids_pkey PRIMARY KEY (storage_leaf_key, state_leaf_key, header_id, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: transaction_cids transaction_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.transaction_cids
|
2022-08-08 16:08:09 +00:00
|
|
|
ADD CONSTRAINT transaction_cids_pkey PRIMARY KEY (tx_hash, header_id, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: uncle_cids uncle_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.uncle_cids
|
2022-04-13 02:56:43 +00:00
|
|
|
ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (block_hash, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
--
|
|
|
|
-- Name: withdrawal_cids withdrawal_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth.withdrawal_cids
|
|
|
|
ADD CONSTRAINT withdrawal_cids_pkey PRIMARY KEY (index, header_id, block_number);
|
|
|
|
|
|
|
|
|
2022-03-17 13:32:05 +00:00
|
|
|
--
|
|
|
|
-- Name: watched_addresses watched_addresses_pkey; Type: CONSTRAINT; Schema: eth_meta; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY eth_meta.watched_addresses
|
|
|
|
ADD CONSTRAINT watched_addresses_pkey PRIMARY KEY (address);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: ipld; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
ALTER TABLE ONLY ipld.blocks
|
2022-03-15 21:06:13 +00:00
|
|
|
ADD CONSTRAINT blocks_pkey PRIMARY KEY (key, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2021-12-27 17:33:26 +00:00
|
|
|
--
|
|
|
|
-- Name: db_version db_version_singleton_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY public.db_version
|
|
|
|
ADD CONSTRAINT db_version_singleton_key UNIQUE (singleton);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
-- Name: goose_db_version goose_db_version_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY public.goose_db_version
|
|
|
|
ADD CONSTRAINT goose_db_version_pkey PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY public.nodes
|
2021-11-18 13:33:22 +00:00
|
|
|
ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2024-07-25 11:16:19 +00:00
|
|
|
--
|
|
|
|
-- Name: blob_hashes_tx_hash_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX blob_hashes_tx_hash_index ON eth.blob_hashes USING btree (tx_hash, index);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2022-03-15 21:06:13 +00:00
|
|
|
-- Name: header_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX header_block_number_index ON eth.header_cids USING btree (block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: header_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE UNIQUE INDEX header_cid_block_number_index ON eth.header_cids USING btree (cid, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2021-11-15 00:06:02 +00:00
|
|
|
-- Name: log_address_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2022-03-15 21:06:13 +00:00
|
|
|
--
|
|
|
|
-- Name: log_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX log_block_number_index ON eth.log_cids USING btree (block_number);
|
2022-03-15 21:06:13 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: log_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2022-08-08 16:08:09 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE INDEX log_cid_block_number_index ON eth.log_cids USING btree (cid, block_number);
|
2022-08-08 16:08:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: log_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id);
|
2022-08-08 16:08:09 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2021-09-10 18:51:47 +00:00
|
|
|
-- Name: log_topic0_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX log_topic0_index ON eth.log_cids USING btree (topic0);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2021-09-10 18:51:47 +00:00
|
|
|
-- Name: log_topic1_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX log_topic1_index ON eth.log_cids USING btree (topic1);
|
2021-09-10 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: log_topic2_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX log_topic2_index ON eth.log_cids USING btree (topic2);
|
2021-09-10 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: log_topic3_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX log_topic3_index ON eth.log_cids USING btree (topic3);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2022-03-15 21:06:13 +00:00
|
|
|
--
|
|
|
|
-- Name: rct_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX rct_block_number_index ON eth.receipt_cids USING btree (block_number);
|
2022-03-15 21:06:13 +00:00
|
|
|
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
--
|
|
|
|
-- Name: rct_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX rct_cid_block_number_index ON eth.receipt_cids USING btree (cid, block_number);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2021-09-30 12:39:48 +00:00
|
|
|
-- Name: rct_contract_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2022-08-08 16:08:09 +00:00
|
|
|
--
|
|
|
|
-- Name: rct_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX rct_header_id_index ON eth.receipt_cids USING btree (header_id);
|
2022-08-08 16:08:09 +00:00
|
|
|
|
|
|
|
|
2022-03-15 21:06:13 +00:00
|
|
|
--
|
|
|
|
-- Name: state_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX state_block_number_index ON eth.state_cids USING btree (block_number);
|
2022-03-15 21:06:13 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: state_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE INDEX state_cid_block_number_index ON eth.state_cids USING btree (cid, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2023-02-02 01:56:57 +00:00
|
|
|
-- Name: state_code_hash_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-02 01:56:57 +00:00
|
|
|
CREATE INDEX state_code_hash_index ON eth.state_cids USING btree (code_hash);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2023-02-02 01:56:57 +00:00
|
|
|
-- Name: state_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-02 01:56:57 +00:00
|
|
|
CREATE INDEX state_header_id_index ON eth.state_cids USING btree (header_id);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2023-02-02 02:22:22 +00:00
|
|
|
--
|
|
|
|
-- Name: state_leaf_key_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX state_leaf_key_block_number_index ON eth.state_cids USING btree (state_leaf_key, block_number DESC);
|
|
|
|
|
|
|
|
|
2023-02-02 01:56:57 +00:00
|
|
|
--
|
|
|
|
-- Name: state_removed_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-02 01:56:57 +00:00
|
|
|
CREATE INDEX state_removed_index ON eth.state_cids USING btree (removed);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: state_root_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2022-03-15 21:06:13 +00:00
|
|
|
--
|
|
|
|
-- Name: storage_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX storage_block_number_index ON eth.storage_cids USING btree (block_number);
|
2022-03-15 21:06:13 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: storage_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE INDEX storage_cid_block_number_index ON eth.storage_cids USING btree (cid, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2022-03-28 23:23:05 +00:00
|
|
|
-- Name: storage_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX storage_header_id_index ON eth.storage_cids USING btree (header_id);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2023-02-02 02:22:22 +00:00
|
|
|
--
|
|
|
|
-- Name: storage_leaf_key_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids USING btree (storage_leaf_key, block_number DESC);
|
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-02 01:56:57 +00:00
|
|
|
-- Name: storage_removed_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-02 01:56:57 +00:00
|
|
|
CREATE INDEX storage_removed_index ON eth.storage_cids USING btree (removed);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2023-02-02 01:56:57 +00:00
|
|
|
-- Name: storage_state_leaf_key_index; Type: INDEX; Schema: eth; Owner: -
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
|
|
|
|
2023-02-02 01:56:57 +00:00
|
|
|
CREATE INDEX storage_state_leaf_key_index ON eth.storage_cids USING btree (state_leaf_key);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: timestamp_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX timestamp_index ON eth.header_cids USING btree ("timestamp");
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2022-03-15 21:06:13 +00:00
|
|
|
--
|
|
|
|
-- Name: tx_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX tx_block_number_index ON eth.transaction_cids USING btree (block_number);
|
2022-03-15 21:06:13 +00:00
|
|
|
|
|
|
|
|
2021-08-29 18:55:44 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: tx_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2022-08-08 16:08:09 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE INDEX tx_cid_block_number_index ON eth.transaction_cids USING btree (cid, block_number);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: tx_dst_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: tx_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: tx_src_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2022-08-30 17:06:01 +00:00
|
|
|
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
|
2021-08-29 18:55:44 +00:00
|
|
|
|
|
|
|
|
2022-03-15 21:06:13 +00:00
|
|
|
--
|
|
|
|
-- Name: uncle_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2023-02-20 19:47:23 +00:00
|
|
|
CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING btree (block_number);
|
2022-03-15 21:06:13 +00:00
|
|
|
|
|
|
|
|
2021-11-15 00:06:02 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: uncle_cid_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
2021-11-15 00:06:02 +00:00
|
|
|
--
|
|
|
|
|
2023-05-15 06:17:32 +00:00
|
|
|
CREATE UNIQUE INDEX uncle_cid_block_number_index ON eth.uncle_cids USING btree (cid, block_number, index);
|
2021-11-15 00:06:02 +00:00
|
|
|
|
|
|
|
|
2022-03-28 23:23:05 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: uncle_header_id_index; Type: INDEX; Schema: eth; Owner: -
|
2022-03-28 23:23:05 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
|
2022-03-28 23:23:05 +00:00
|
|
|
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
--
|
|
|
|
-- Name: withdrawal_cids_block_number_idx; Type: INDEX; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX withdrawal_cids_block_number_idx ON eth.withdrawal_cids USING btree (block_number DESC);
|
|
|
|
|
|
|
|
|
2022-08-15 16:15:48 +00:00
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: blocks_block_number_idx; Type: INDEX; Schema: ipld; Owner: -
|
2022-08-15 16:15:48 +00:00
|
|
|
--
|
|
|
|
|
2023-02-09 00:35:16 +00:00
|
|
|
CREATE INDEX blocks_block_number_idx ON ipld.blocks USING btree (block_number DESC);
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: log_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.log_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: receipt_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.receipt_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: state_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.state_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: storage_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.storage_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: transaction_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.transaction_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: uncle_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.uncle_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: withdrawal_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.withdrawal_cids FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2023-02-09 00:35:16 +00:00
|
|
|
-- Name: blocks ts_insert_blocker; Type: TRIGGER; Schema: ipld; Owner: -
|
2022-08-15 16:15:48 +00:00
|
|
|
--
|
|
|
|
|
2024-06-28 12:36:18 +00:00
|
|
|
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON ipld.blocks FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker();
|
2022-08-15 16:15:48 +00:00
|
|
|
|
|
|
|
|
2021-12-08 08:00:59 +00:00
|
|
|
--
|
|
|
|
-- PostgreSQL database dump complete
|
2021-12-20 08:32:23 +00:00
|
|
|
--
|
|
|
|
|