1598 lines
38 KiB
SQL
1598 lines
38 KiB
SQL
--
|
|
-- PostgreSQL database dump
|
|
--
|
|
|
|
-- Dumped from database version 10.10
|
|
-- Dumped by pg_dump version 11.5
|
|
|
|
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;
|
|
|
|
SET default_tablespace = '';
|
|
|
|
SET default_with_oids = false;
|
|
|
|
--
|
|
-- Name: addresses; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.addresses (
|
|
id integer NOT NULL,
|
|
address character varying(42),
|
|
hashed_address character varying(66)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.addresses_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.addresses_id_seq OWNED BY public.addresses.id;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_logs; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.full_sync_logs (
|
|
id integer NOT NULL,
|
|
block_number bigint,
|
|
address character varying(66),
|
|
tx_hash character varying(66),
|
|
index bigint,
|
|
topic0 character varying(66),
|
|
topic1 character varying(66),
|
|
topic2 character varying(66),
|
|
topic3 character varying(66),
|
|
data text,
|
|
receipt_id integer
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: block_stats; Type: VIEW; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE VIEW public.block_stats AS
|
|
SELECT max(full_sync_logs.block_number) AS max_block,
|
|
min(full_sync_logs.block_number) AS min_block
|
|
FROM public.full_sync_logs;
|
|
|
|
|
|
--
|
|
-- Name: blocks; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.blocks (
|
|
key text NOT NULL,
|
|
data bytea NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: checked_headers; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.checked_headers (
|
|
id integer NOT NULL,
|
|
header_id integer NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: checked_headers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.checked_headers_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: checked_headers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.checked_headers_id_seq OWNED BY public.checked_headers.id;
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.eth_blocks (
|
|
id integer NOT NULL,
|
|
difficulty bigint,
|
|
extra_data character varying,
|
|
gas_limit bigint,
|
|
gas_used bigint,
|
|
hash character varying(66),
|
|
miner character varying(42),
|
|
nonce character varying(20),
|
|
number bigint,
|
|
parent_hash character varying(66),
|
|
reward numeric,
|
|
uncles_reward numeric,
|
|
size character varying,
|
|
"time" bigint,
|
|
is_final boolean,
|
|
uncle_hash character varying(66),
|
|
eth_node_id integer NOT NULL,
|
|
eth_node_fingerprint character varying(128) NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.eth_blocks_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.eth_blocks_id_seq OWNED BY public.eth_blocks.id;
|
|
|
|
|
|
--
|
|
-- Name: eth_nodes; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.eth_nodes (
|
|
id integer NOT NULL,
|
|
client_name character varying,
|
|
genesis_block character varying(66),
|
|
network_id numeric,
|
|
eth_node_id character varying(128)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.full_sync_logs_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.full_sync_logs_id_seq OWNED BY public.full_sync_logs.id;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.full_sync_receipts (
|
|
id integer NOT NULL,
|
|
contract_address_id integer NOT NULL,
|
|
cumulative_gas_used numeric,
|
|
gas_used numeric,
|
|
state_root character varying(66),
|
|
status integer,
|
|
tx_hash character varying(66),
|
|
block_id integer NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.full_sync_receipts_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.full_sync_receipts_id_seq OWNED BY public.full_sync_receipts.id;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_transactions; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.full_sync_transactions (
|
|
id integer NOT NULL,
|
|
block_id integer NOT NULL,
|
|
gas_limit numeric,
|
|
gas_price numeric,
|
|
hash character varying(66),
|
|
input_data bytea,
|
|
nonce numeric,
|
|
raw bytea,
|
|
tx_from character varying(66),
|
|
tx_index integer,
|
|
tx_to character varying(66),
|
|
value numeric
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.full_sync_transactions_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.full_sync_transactions_id_seq OWNED BY public.full_sync_transactions.id;
|
|
|
|
|
|
--
|
|
-- 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: header_cids; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.header_cids (
|
|
id integer NOT NULL,
|
|
block_number bigint NOT NULL,
|
|
block_hash character varying(66) NOT NULL,
|
|
cid text NOT NULL,
|
|
uncle boolean NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: header_cids_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.header_cids_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: header_cids_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.header_cids_id_seq OWNED BY public.header_cids.id;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.header_sync_logs (
|
|
id integer NOT NULL,
|
|
header_id integer NOT NULL,
|
|
address integer NOT NULL,
|
|
topics bytea[],
|
|
data bytea,
|
|
block_number bigint,
|
|
block_hash character varying(66),
|
|
tx_hash character varying(66),
|
|
tx_index integer,
|
|
log_index integer,
|
|
raw jsonb,
|
|
transformed boolean DEFAULT false NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.header_sync_logs_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.header_sync_logs_id_seq OWNED BY public.header_sync_logs.id;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.header_sync_receipts (
|
|
id integer NOT NULL,
|
|
transaction_id integer NOT NULL,
|
|
header_id integer NOT NULL,
|
|
contract_address_id integer NOT NULL,
|
|
cumulative_gas_used numeric,
|
|
gas_used numeric,
|
|
state_root character varying(66),
|
|
status integer,
|
|
tx_hash character varying(66),
|
|
rlp bytea
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.header_sync_receipts_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.header_sync_receipts_id_seq OWNED BY public.header_sync_receipts.id;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.header_sync_transactions (
|
|
id integer NOT NULL,
|
|
header_id integer NOT NULL,
|
|
hash character varying(66),
|
|
gas_limit numeric,
|
|
gas_price numeric,
|
|
input_data bytea,
|
|
nonce numeric,
|
|
raw bytea,
|
|
tx_from character varying(44),
|
|
tx_index integer,
|
|
tx_to character varying(44),
|
|
value numeric
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.header_sync_transactions_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.header_sync_transactions_id_seq OWNED BY public.header_sync_transactions.id;
|
|
|
|
|
|
--
|
|
-- Name: headers; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.headers (
|
|
id integer NOT NULL,
|
|
hash character varying(66),
|
|
block_number bigint,
|
|
raw jsonb,
|
|
block_timestamp numeric,
|
|
check_count integer DEFAULT 0 NOT NULL,
|
|
eth_node_id integer NOT NULL,
|
|
eth_node_fingerprint character varying(128)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: headers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.headers_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: headers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.headers_id_seq OWNED BY public.headers.id;
|
|
|
|
|
|
--
|
|
-- Name: log_filters; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.log_filters (
|
|
id integer NOT NULL,
|
|
name character varying NOT NULL,
|
|
from_block bigint,
|
|
to_block bigint,
|
|
address character varying(66),
|
|
topic0 character varying(66),
|
|
topic1 character varying(66),
|
|
topic2 character varying(66),
|
|
topic3 character varying(66),
|
|
CONSTRAINT log_filters_from_block_check CHECK ((from_block >= 0)),
|
|
CONSTRAINT log_filters_name_check CHECK (((name)::text <> ''::text)),
|
|
CONSTRAINT log_filters_to_block_check CHECK ((to_block >= 0))
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: log_filters_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.log_filters_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: log_filters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.log_filters_id_seq OWNED BY public.log_filters.id;
|
|
|
|
|
|
--
|
|
-- Name: nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.nodes_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.nodes_id_seq OWNED BY public.eth_nodes.id;
|
|
|
|
|
|
--
|
|
-- Name: queued_storage; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.queued_storage (
|
|
id integer NOT NULL,
|
|
diff_id bigint NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: queued_storage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.queued_storage_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: queued_storage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.queued_storage_id_seq OWNED BY public.queued_storage.id;
|
|
|
|
|
|
--
|
|
-- Name: receipt_cids; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.receipt_cids (
|
|
id integer NOT NULL,
|
|
tx_id integer NOT NULL,
|
|
cid text NOT NULL,
|
|
contract character varying(66),
|
|
topic0s character varying(66)[]
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: receipt_cids_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.receipt_cids_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: receipt_cids_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.receipt_cids_id_seq OWNED BY public.receipt_cids.id;
|
|
|
|
|
|
--
|
|
-- Name: state_cids; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.state_cids (
|
|
id integer NOT NULL,
|
|
header_id integer NOT NULL,
|
|
state_key character varying(66) NOT NULL,
|
|
leaf boolean NOT NULL,
|
|
cid text NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: state_cids_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.state_cids_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: state_cids_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.state_cids_id_seq OWNED BY public.state_cids.id;
|
|
|
|
|
|
--
|
|
-- Name: storage_cids; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.storage_cids (
|
|
id integer NOT NULL,
|
|
state_id integer NOT NULL,
|
|
storage_key character varying(66) NOT NULL,
|
|
leaf boolean NOT NULL,
|
|
cid text NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: storage_cids_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.storage_cids_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: storage_cids_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.storage_cids_id_seq OWNED BY public.storage_cids.id;
|
|
|
|
|
|
--
|
|
-- Name: storage_diff; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.storage_diff (
|
|
id integer NOT NULL,
|
|
block_height bigint,
|
|
block_hash bytea,
|
|
hashed_address bytea,
|
|
storage_key bytea,
|
|
storage_value bytea
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: storage_diff_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.storage_diff_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: storage_diff_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.storage_diff_id_seq OWNED BY public.storage_diff.id;
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.transaction_cids (
|
|
id integer NOT NULL,
|
|
header_id integer NOT NULL,
|
|
tx_hash character varying(66) NOT NULL,
|
|
cid text NOT NULL,
|
|
dst character varying(66) NOT NULL,
|
|
src character varying(66) NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.transaction_cids_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.transaction_cids_id_seq OWNED BY public.transaction_cids.id;
|
|
|
|
|
|
--
|
|
-- Name: uncles; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.uncles (
|
|
id integer NOT NULL,
|
|
hash character varying(66) NOT NULL,
|
|
block_id integer NOT NULL,
|
|
reward numeric NOT NULL,
|
|
miner character varying(42) NOT NULL,
|
|
raw jsonb,
|
|
block_timestamp numeric,
|
|
eth_node_id integer NOT NULL,
|
|
eth_node_fingerprint character varying(128)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: uncles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.uncles_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: uncles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.uncles_id_seq OWNED BY public.uncles.id;
|
|
|
|
|
|
--
|
|
-- Name: watched_contracts; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.watched_contracts (
|
|
contract_id integer NOT NULL,
|
|
contract_abi json,
|
|
contract_hash character varying(66)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: watched_contracts_contract_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.watched_contracts_contract_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: watched_contracts_contract_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.watched_contracts_contract_id_seq OWNED BY public.watched_contracts.contract_id;
|
|
|
|
|
|
--
|
|
-- Name: watched_event_logs; Type: VIEW; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE VIEW public.watched_event_logs AS
|
|
SELECT log_filters.name,
|
|
full_sync_logs.id,
|
|
full_sync_logs.block_number,
|
|
full_sync_logs.address,
|
|
full_sync_logs.tx_hash,
|
|
full_sync_logs.index,
|
|
full_sync_logs.topic0,
|
|
full_sync_logs.topic1,
|
|
full_sync_logs.topic2,
|
|
full_sync_logs.topic3,
|
|
full_sync_logs.data,
|
|
full_sync_logs.receipt_id
|
|
FROM ((public.log_filters
|
|
CROSS JOIN public.block_stats)
|
|
JOIN public.full_sync_logs ON ((((full_sync_logs.address)::text = (log_filters.address)::text) AND (full_sync_logs.block_number >= COALESCE(log_filters.from_block, block_stats.min_block)) AND (full_sync_logs.block_number <= COALESCE(log_filters.to_block, block_stats.max_block)))))
|
|
WHERE ((((log_filters.topic0)::text = (full_sync_logs.topic0)::text) OR (log_filters.topic0 IS NULL)) AND (((log_filters.topic1)::text = (full_sync_logs.topic1)::text) OR (log_filters.topic1 IS NULL)) AND (((log_filters.topic2)::text = (full_sync_logs.topic2)::text) OR (log_filters.topic2 IS NULL)) AND (((log_filters.topic3)::text = (full_sync_logs.topic3)::text) OR (log_filters.topic3 IS NULL)));
|
|
|
|
|
|
--
|
|
-- Name: watched_logs; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.watched_logs (
|
|
id integer NOT NULL,
|
|
contract_address character varying(42),
|
|
topic_zero character varying(66)
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: watched_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.watched_logs_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: watched_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.watched_logs_id_seq OWNED BY public.watched_logs.id;
|
|
|
|
|
|
--
|
|
-- Name: addresses id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.addresses ALTER COLUMN id SET DEFAULT nextval('public.addresses_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: checked_headers id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.checked_headers ALTER COLUMN id SET DEFAULT nextval('public.checked_headers_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_blocks ALTER COLUMN id SET DEFAULT nextval('public.eth_blocks_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: eth_nodes id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_nodes ALTER COLUMN id SET DEFAULT nextval('public.nodes_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_logs id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_logs ALTER COLUMN id SET DEFAULT nextval('public.full_sync_logs_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_receipts ALTER COLUMN id SET DEFAULT nextval('public.full_sync_receipts_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_transactions id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_transactions ALTER COLUMN id SET DEFAULT nextval('public.full_sync_transactions_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- 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 id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_cids ALTER COLUMN id SET DEFAULT nextval('public.header_cids_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_logs ALTER COLUMN id SET DEFAULT nextval('public.header_sync_logs_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_receipts ALTER COLUMN id SET DEFAULT nextval('public.header_sync_receipts_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_transactions ALTER COLUMN id SET DEFAULT nextval('public.header_sync_transactions_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: headers id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.headers ALTER COLUMN id SET DEFAULT nextval('public.headers_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: log_filters id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.log_filters ALTER COLUMN id SET DEFAULT nextval('public.log_filters_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: queued_storage id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.queued_storage ALTER COLUMN id SET DEFAULT nextval('public.queued_storage_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: receipt_cids id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.receipt_cids ALTER COLUMN id SET DEFAULT nextval('public.receipt_cids_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: state_cids id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.state_cids ALTER COLUMN id SET DEFAULT nextval('public.state_cids_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: storage_cids id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_cids ALTER COLUMN id SET DEFAULT nextval('public.storage_cids_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: storage_diff id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_diff ALTER COLUMN id SET DEFAULT nextval('public.storage_diff_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction_cids ALTER COLUMN id SET DEFAULT nextval('public.transaction_cids_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: uncles id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.uncles ALTER COLUMN id SET DEFAULT nextval('public.uncles_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: watched_contracts contract_id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.watched_contracts ALTER COLUMN contract_id SET DEFAULT nextval('public.watched_contracts_contract_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: watched_logs id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.watched_logs ALTER COLUMN id SET DEFAULT nextval('public.watched_logs_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: addresses addresses_address_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.addresses
|
|
ADD CONSTRAINT addresses_address_key UNIQUE (address);
|
|
|
|
|
|
--
|
|
-- Name: addresses addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.addresses
|
|
ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: blocks blocks_key_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.blocks
|
|
ADD CONSTRAINT blocks_key_key UNIQUE (key);
|
|
|
|
|
|
--
|
|
-- Name: checked_headers checked_headers_header_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.checked_headers
|
|
ADD CONSTRAINT checked_headers_header_id_key UNIQUE (header_id);
|
|
|
|
|
|
--
|
|
-- Name: checked_headers checked_headers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.checked_headers
|
|
ADD CONSTRAINT checked_headers_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks eth_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_blocks
|
|
ADD CONSTRAINT eth_blocks_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks eth_node_id_block_number_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_blocks
|
|
ADD CONSTRAINT eth_node_id_block_number_uc UNIQUE (number, eth_node_id);
|
|
|
|
|
|
--
|
|
-- Name: eth_nodes eth_node_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_nodes
|
|
ADD CONSTRAINT eth_node_uc UNIQUE (genesis_block, network_id, eth_node_id);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_logs full_sync_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_logs
|
|
ADD CONSTRAINT full_sync_logs_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts full_sync_receipts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_receipts
|
|
ADD CONSTRAINT full_sync_receipts_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: full_sync_transactions full_sync_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_transactions
|
|
ADD CONSTRAINT full_sync_transactions_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- 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: header_cids header_cids_block_number_block_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_cids
|
|
ADD CONSTRAINT header_cids_block_number_block_hash_key UNIQUE (block_number, block_hash);
|
|
|
|
|
|
--
|
|
-- Name: header_cids header_cids_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_cids
|
|
ADD CONSTRAINT header_cids_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs header_sync_logs_header_id_tx_index_log_index_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_logs
|
|
ADD CONSTRAINT header_sync_logs_header_id_tx_index_log_index_key UNIQUE (header_id, tx_index, log_index);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs header_sync_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_logs
|
|
ADD CONSTRAINT header_sync_logs_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts header_sync_receipts_header_id_transaction_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_receipts
|
|
ADD CONSTRAINT header_sync_receipts_header_id_transaction_id_key UNIQUE (header_id, transaction_id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts header_sync_receipts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_receipts
|
|
ADD CONSTRAINT header_sync_receipts_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions header_sync_transactions_header_id_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_transactions
|
|
ADD CONSTRAINT header_sync_transactions_header_id_hash_key UNIQUE (header_id, hash);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions header_sync_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_transactions
|
|
ADD CONSTRAINT header_sync_transactions_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: headers headers_block_number_hash_eth_node_fingerprint_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.headers
|
|
ADD CONSTRAINT headers_block_number_hash_eth_node_fingerprint_key UNIQUE (block_number, hash, eth_node_fingerprint);
|
|
|
|
|
|
--
|
|
-- Name: headers headers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.headers
|
|
ADD CONSTRAINT headers_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: log_filters name_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.log_filters
|
|
ADD CONSTRAINT name_uc UNIQUE (name);
|
|
|
|
|
|
--
|
|
-- Name: eth_nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_nodes
|
|
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: queued_storage queued_storage_diff_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.queued_storage
|
|
ADD CONSTRAINT queued_storage_diff_id_key UNIQUE (diff_id);
|
|
|
|
|
|
--
|
|
-- Name: queued_storage queued_storage_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.queued_storage
|
|
ADD CONSTRAINT queued_storage_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: receipt_cids receipt_cids_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.receipt_cids
|
|
ADD CONSTRAINT receipt_cids_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: state_cids state_cids_header_id_state_key_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.state_cids
|
|
ADD CONSTRAINT state_cids_header_id_state_key_key UNIQUE (header_id, state_key);
|
|
|
|
|
|
--
|
|
-- Name: state_cids state_cids_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.state_cids
|
|
ADD CONSTRAINT state_cids_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: storage_cids storage_cids_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_cids
|
|
ADD CONSTRAINT storage_cids_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: storage_cids storage_cids_state_id_storage_key_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_cids
|
|
ADD CONSTRAINT storage_cids_state_id_storage_key_key UNIQUE (state_id, storage_key);
|
|
|
|
|
|
--
|
|
-- Name: storage_diff storage_diff_block_height_block_hash_hashed_address_storage_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_diff
|
|
ADD CONSTRAINT storage_diff_block_height_block_hash_hashed_address_storage_key UNIQUE (block_height, block_hash, hashed_address, storage_key, storage_value);
|
|
|
|
|
|
--
|
|
-- Name: storage_diff storage_diff_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_diff
|
|
ADD CONSTRAINT storage_diff_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids transaction_cids_header_id_tx_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction_cids
|
|
ADD CONSTRAINT transaction_cids_header_id_tx_hash_key UNIQUE (header_id, tx_hash);
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids transaction_cids_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction_cids
|
|
ADD CONSTRAINT transaction_cids_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: uncles uncles_block_id_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.uncles
|
|
ADD CONSTRAINT uncles_block_id_hash_key UNIQUE (block_id, hash);
|
|
|
|
|
|
--
|
|
-- Name: uncles uncles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.uncles
|
|
ADD CONSTRAINT uncles_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: watched_contracts watched_contracts_contract_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.watched_contracts
|
|
ADD CONSTRAINT watched_contracts_contract_hash_key UNIQUE (contract_hash);
|
|
|
|
|
|
--
|
|
-- Name: watched_contracts watched_contracts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.watched_contracts
|
|
ADD CONSTRAINT watched_contracts_pkey PRIMARY KEY (contract_id);
|
|
|
|
|
|
--
|
|
-- Name: watched_logs watched_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.watched_logs
|
|
ADD CONSTRAINT watched_logs_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: block_id_index; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX block_id_index ON public.full_sync_transactions USING btree (block_id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts_header; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX header_sync_receipts_header ON public.header_sync_receipts USING btree (header_id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts_transaction; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX header_sync_receipts_transaction ON public.header_sync_receipts USING btree (transaction_id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions_header; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX header_sync_transactions_header ON public.header_sync_transactions USING btree (header_id);
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions_tx_index; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX header_sync_transactions_tx_index ON public.header_sync_transactions USING btree (tx_index);
|
|
|
|
|
|
--
|
|
-- Name: headers_block_number; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX headers_block_number ON public.headers USING btree (block_number);
|
|
|
|
|
|
--
|
|
-- Name: headers_block_timestamp; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX headers_block_timestamp ON public.headers USING btree (block_timestamp);
|
|
|
|
|
|
--
|
|
-- Name: node_id_index; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX node_id_index ON public.eth_blocks USING btree (eth_node_id);
|
|
|
|
|
|
--
|
|
-- Name: number_index; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX number_index ON public.eth_blocks USING btree (number);
|
|
|
|
|
|
--
|
|
-- Name: tx_from_index; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX tx_from_index ON public.full_sync_transactions USING btree (tx_from);
|
|
|
|
|
|
--
|
|
-- Name: tx_to_index; Type: INDEX; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE INDEX tx_to_index ON public.full_sync_transactions USING btree (tx_to);
|
|
|
|
|
|
--
|
|
-- Name: checked_headers checked_headers_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.checked_headers
|
|
ADD CONSTRAINT checked_headers_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts eth_blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_receipts
|
|
ADD CONSTRAINT eth_blocks_fk FOREIGN KEY (block_id) REFERENCES public.eth_blocks(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_receipts full_sync_receipts_contract_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_receipts
|
|
ADD CONSTRAINT full_sync_receipts_contract_address_id_fkey FOREIGN KEY (contract_address_id) REFERENCES public.addresses(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_transactions full_sync_transactions_block_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_transactions
|
|
ADD CONSTRAINT full_sync_transactions_block_id_fkey FOREIGN KEY (block_id) REFERENCES public.eth_blocks(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs header_sync_logs_address_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_logs
|
|
ADD CONSTRAINT header_sync_logs_address_fkey FOREIGN KEY (address) REFERENCES public.addresses(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_logs header_sync_logs_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_logs
|
|
ADD CONSTRAINT header_sync_logs_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts header_sync_receipts_contract_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_receipts
|
|
ADD CONSTRAINT header_sync_receipts_contract_address_id_fkey FOREIGN KEY (contract_address_id) REFERENCES public.addresses(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts header_sync_receipts_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_receipts
|
|
ADD CONSTRAINT header_sync_receipts_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_receipts header_sync_receipts_transaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_receipts
|
|
ADD CONSTRAINT header_sync_receipts_transaction_id_fkey FOREIGN KEY (transaction_id) REFERENCES public.header_sync_transactions(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: header_sync_transactions header_sync_transactions_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.header_sync_transactions
|
|
ADD CONSTRAINT header_sync_transactions_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: headers headers_eth_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.headers
|
|
ADD CONSTRAINT headers_eth_node_id_fkey FOREIGN KEY (eth_node_id) REFERENCES public.eth_nodes(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: eth_blocks node_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.eth_blocks
|
|
ADD CONSTRAINT node_fk FOREIGN KEY (eth_node_id) REFERENCES public.eth_nodes(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: queued_storage queued_storage_diff_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.queued_storage
|
|
ADD CONSTRAINT queued_storage_diff_id_fkey FOREIGN KEY (diff_id) REFERENCES public.storage_diff(id);
|
|
|
|
|
|
--
|
|
-- Name: receipt_cids receipt_cids_tx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.receipt_cids
|
|
ADD CONSTRAINT receipt_cids_tx_id_fkey FOREIGN KEY (tx_id) REFERENCES public.transaction_cids(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
|
|
|
|
|
--
|
|
-- Name: full_sync_logs receipts_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.full_sync_logs
|
|
ADD CONSTRAINT receipts_fk FOREIGN KEY (receipt_id) REFERENCES public.full_sync_receipts(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: state_cids state_cids_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.state_cids
|
|
ADD CONSTRAINT state_cids_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.header_cids(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
|
|
|
|
|
--
|
|
-- Name: storage_cids storage_cids_state_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.storage_cids
|
|
ADD CONSTRAINT storage_cids_state_id_fkey FOREIGN KEY (state_id) REFERENCES public.state_cids(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
|
|
|
|
|
--
|
|
-- Name: transaction_cids transaction_cids_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.transaction_cids
|
|
ADD CONSTRAINT transaction_cids_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.header_cids(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
|
|
|
|
|
--
|
|
-- Name: uncles uncles_block_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.uncles
|
|
ADD CONSTRAINT uncles_block_id_fkey FOREIGN KEY (block_id) REFERENCES public.eth_blocks(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- Name: uncles uncles_eth_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.uncles
|
|
ADD CONSTRAINT uncles_eth_node_id_fkey FOREIGN KEY (eth_node_id) REFERENCES public.eth_nodes(id) ON DELETE CASCADE;
|
|
|
|
|
|
--
|
|
-- PostgreSQL database dump complete
|
|
--
|
|
|