ipld-eth-server/db/schema.sql

857 lines
18 KiB
MySQL
Raw Normal View History

2018-01-16 15:11:23 +00:00
--
-- PostgreSQL database dump
--
2018-04-11 16:02:29 +00:00
-- Dumped from database version 10.3
-- Dumped by pg_dump version 10.3
2018-01-16 15:11:23 +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;
2018-04-11 16:02:29 +00:00
SELECT pg_catalog.set_config('search_path', '', false);
2018-01-16 15:11:23 +00:00
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
2018-08-07 15:51:34 +00:00
--
-- Name: maker; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA maker;
2018-01-16 15:11:23 +00:00
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET default_tablespace = '';
SET default_with_oids = false;
2018-08-07 15:51:34 +00:00
--
-- Name: flip_kick; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.flip_kick (
db_id integer NOT NULL,
header_id integer NOT NULL,
id numeric NOT NULL,
mom character varying,
vat character varying,
ilk character varying,
lot numeric,
bid numeric,
guy character varying,
gal character varying,
"end" timestamp with time zone,
era timestamp with time zone,
lad character varying,
tab numeric
);
--
-- Name: flip_kick_db_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.flip_kick_db_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: flip_kick_db_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.flip_kick_db_id_seq OWNED BY maker.flip_kick.db_id;
2018-08-09 21:55:02 +00:00
--
-- Name: frob; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.frob (
id integer NOT NULL,
header_id integer NOT NULL,
tx_idx integer,
ilk bytea,
lad bytea,
gem numeric,
ink numeric,
art numeric,
era numeric
);
--
-- Name: frob_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.frob_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: frob_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.frob_id_seq OWNED BY maker.frob.id;
2018-07-24 16:38:49 +00:00
--
-- Name: peps; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.peps (
id integer NOT NULL,
block_number bigint NOT NULL,
header_id integer NOT NULL,
usd_value numeric
);
--
-- Name: peps_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.peps_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: peps_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.peps_id_seq OWNED BY maker.peps.id;
--
-- Name: logs; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.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: -
--
2018-04-11 16:02:29 +00:00
CREATE VIEW public.block_stats AS
SELECT max(logs.block_number) AS max_block,
min(logs.block_number) AS min_block
2018-04-11 16:02:29 +00:00
FROM public.logs;
2018-01-16 15:11:23 +00:00
--
-- Name: blocks; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.blocks (
number bigint,
gaslimit bigint,
gasused bigint,
"time" bigint,
2018-01-16 15:11:23 +00:00
id integer NOT NULL,
difficulty bigint,
hash character varying(66),
nonce character varying(20),
parenthash character varying(66),
size character varying,
2018-01-16 15:11:23 +00:00
uncle_hash character varying(66),
2018-03-21 14:53:20 +00:00
eth_node_id integer NOT NULL,
2018-01-16 15:11:23 +00:00
is_final boolean,
miner character varying(42),
extra_data character varying,
reward double precision,
uncles_reward double precision,
eth_node_fingerprint character varying(128) NOT NULL
2018-01-16 15:11:23 +00:00
);
--
-- Name: blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE SEQUENCE public.blocks_id_seq
2018-01-16 15:11:23 +00:00
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.blocks_id_seq OWNED BY public.blocks.id;
2018-01-16 15:11:23 +00:00
2018-03-21 14:53:20 +00:00
--
-- Name: eth_nodes; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.eth_nodes (
2018-03-21 14:53:20 +00:00
id integer NOT NULL,
genesis_block character varying(66),
network_id numeric,
eth_node_id character varying(128),
client_name character varying
);
--
-- Name: headers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.headers (
id integer NOT NULL,
hash character varying(66),
block_number bigint,
raw bytea,
eth_node_id integer,
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;
2018-01-16 15:11:23 +00:00
--
-- Name: log_filters; Type: TABLE; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.log_filters (
2018-01-16 15:11:23 +00:00
id integer NOT NULL,
name character varying NOT NULL,
from_block bigint,
to_block bigint,
2018-01-16 15:11:23 +00:00
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))
2018-01-16 15:11:23 +00:00
);
--
-- Name: log_filters_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
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: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.log_filters_id_seq OWNED BY public.log_filters.id;
2018-01-16 15:11:23 +00:00
--
-- Name: logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE SEQUENCE public.logs_id_seq
2018-01-16 15:11:23 +00:00
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.logs_id_seq OWNED BY public.logs.id;
2018-01-16 15:11:23 +00:00
--
-- Name: nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE SEQUENCE public.nodes_id_seq
2018-01-16 15:11:23 +00:00
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: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.nodes_id_seq OWNED BY public.eth_nodes.id;
2018-01-16 15:11:23 +00:00
--
-- Name: receipts; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.receipts (
2018-01-16 15:11:23 +00:00
id integer NOT NULL,
contract_address character varying(42),
cumulative_gas_used numeric,
gas_used numeric,
state_root character varying(66),
status integer,
tx_hash character varying(66),
block_id integer NOT NULL
2018-01-16 15:11:23 +00:00
);
--
-- Name: receipts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE SEQUENCE public.receipts_id_seq
2018-01-16 15:11:23 +00:00
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: receipts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.receipts_id_seq OWNED BY public.receipts.id;
2018-01-16 15:11:23 +00:00
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.schema_migrations (
2018-01-16 15:11:23 +00:00
version bigint NOT NULL,
dirty boolean NOT NULL
);
--
-- Name: token_supply; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.token_supply (
id integer NOT NULL,
block_id integer NOT NULL,
supply numeric NOT NULL,
token_address character varying(66) NOT NULL
);
--
-- Name: token_supply_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.token_supply_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: token_supply_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.token_supply_id_seq OWNED BY public.token_supply.id;
2018-01-16 15:11:23 +00:00
--
-- Name: transactions; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.transactions (
2018-01-16 15:11:23 +00:00
id integer NOT NULL,
hash character varying(66),
nonce numeric,
2018-01-16 15:11:23 +00:00
tx_to character varying(66),
gaslimit numeric,
gasprice numeric,
value numeric,
2018-01-16 15:11:23 +00:00
block_id integer NOT NULL,
tx_from character varying(66),
input_data character varying
2018-01-16 15:11:23 +00:00
);
--
-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE SEQUENCE public.transactions_id_seq
2018-01-16 15:11:23 +00:00
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
2018-01-16 15:11:23 +00:00
--
-- Name: watched_contracts; Type: TABLE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE TABLE public.watched_contracts (
2018-01-16 15:11:23 +00:00
contract_id integer NOT NULL,
contract_hash character varying(66),
contract_abi json
);
--
-- Name: watched_contracts_contract_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE SEQUENCE public.watched_contracts_contract_id_seq
2018-01-16 15:11:23 +00:00
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: -
--
2018-04-11 16:02:29 +00:00
ALTER SEQUENCE public.watched_contracts_contract_id_seq OWNED BY public.watched_contracts.contract_id;
2018-01-16 15:11:23 +00:00
--
-- Name: watched_event_logs; Type: VIEW; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE VIEW public.watched_event_logs AS
SELECT log_filters.name,
logs.id,
logs.block_number,
logs.address,
logs.tx_hash,
logs.index,
logs.topic0,
logs.topic1,
logs.topic2,
logs.topic3,
logs.data,
logs.receipt_id
2018-04-11 16:02:29 +00:00
FROM ((public.log_filters
CROSS JOIN public.block_stats)
JOIN public.logs ON ((((logs.address)::text = (log_filters.address)::text) AND (logs.block_number >= COALESCE(log_filters.from_block, block_stats.min_block)) AND (logs.block_number <= COALESCE(log_filters.to_block, block_stats.max_block)))))
WHERE ((((log_filters.topic0)::text = (logs.topic0)::text) OR (log_filters.topic0 IS NULL)) AND (((log_filters.topic1)::text = (logs.topic1)::text) OR (log_filters.topic1 IS NULL)) AND (((log_filters.topic2)::text = (logs.topic2)::text) OR (log_filters.topic2 IS NULL)) AND (((log_filters.topic3)::text = (logs.topic3)::text) OR (log_filters.topic3 IS NULL)));
2018-08-07 15:51:34 +00:00
--
-- Name: flip_kick db_id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.flip_kick ALTER COLUMN db_id SET DEFAULT nextval('maker.flip_kick_db_id_seq'::regclass);
2018-08-09 21:55:02 +00:00
--
-- Name: frob id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.frob ALTER COLUMN id SET DEFAULT nextval('maker.frob_id_seq'::regclass);
2018-07-24 16:38:49 +00:00
--
-- Name: peps id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.peps ALTER COLUMN id SET DEFAULT nextval('maker.peps_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.blocks ALTER COLUMN id SET DEFAULT nextval('public.blocks_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: eth_nodes id; Type: DEFAULT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.eth_nodes ALTER COLUMN id SET DEFAULT nextval('public.nodes_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);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: log_filters id; Type: DEFAULT; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.log_filters ALTER COLUMN id SET DEFAULT nextval('public.log_filters_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: logs id; Type: DEFAULT; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.logs ALTER COLUMN id SET DEFAULT nextval('public.logs_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
-- Name: receipts id; Type: DEFAULT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.receipts ALTER COLUMN id SET DEFAULT nextval('public.receipts_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
-- Name: token_supply id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.token_supply ALTER COLUMN id SET DEFAULT nextval('public.token_supply_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
--
-- Name: watched_contracts contract_id; Type: DEFAULT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.watched_contracts ALTER COLUMN contract_id SET DEFAULT nextval('public.watched_contracts_contract_id_seq'::regclass);
2018-01-16 15:11:23 +00:00
2018-08-07 15:51:34 +00:00
--
-- Name: flip_kick flip_kick_id_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.flip_kick
ADD CONSTRAINT flip_kick_id_key UNIQUE (id);
--
-- Name: flip_kick flip_kick_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.flip_kick
ADD CONSTRAINT flip_kick_pkey PRIMARY KEY (db_id);
2018-08-09 21:55:02 +00:00
--
-- Name: frob frob_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.frob
ADD CONSTRAINT frob_header_id_tx_idx_key UNIQUE (header_id, tx_idx);
--
-- Name: frob frob_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.frob
ADD CONSTRAINT frob_pkey PRIMARY KEY (id);
2018-07-24 16:38:49 +00:00
--
-- Name: peps peps_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.peps
ADD CONSTRAINT peps_pkey PRIMARY KEY (id);
2018-01-16 15:11:23 +00:00
--
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.blocks
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT blocks_pkey PRIMARY KEY (id);
--
-- Name: watched_contracts contract_hash_uc; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.watched_contracts
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT contract_hash_uc UNIQUE (contract_hash);
--
2018-03-21 14:53:20 +00:00
-- Name: blocks eth_node_id_block_number_uc; Type: CONSTRAINT; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.blocks
2018-03-21 14:53:20 +00:00
ADD CONSTRAINT eth_node_id_block_number_uc UNIQUE (number, eth_node_id);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: eth_nodes eth_node_uc; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.eth_nodes
2018-03-21 14:53:20 +00:00
ADD CONSTRAINT eth_node_uc UNIQUE (genesis_block, network_id, eth_node_id);
--
-- Name: headers headers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.headers
ADD CONSTRAINT headers_pkey PRIMARY KEY (id);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: logs logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.logs
2018-03-21 14:53:20 +00:00
ADD CONSTRAINT logs_pkey PRIMARY KEY (id);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: log_filters name_uc; Type: CONSTRAINT; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.log_filters
2018-03-21 14:53:20 +00:00
ADD CONSTRAINT name_uc UNIQUE (name);
2018-01-16 15:11:23 +00:00
--
2018-03-21 14:53:20 +00:00
-- Name: eth_nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2018-01-16 15:11:23 +00:00
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.eth_nodes
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
--
-- Name: receipts receipts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.receipts
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT receipts_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.schema_migrations
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.transactions
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
--
-- Name: watched_contracts watched_contracts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.watched_contracts
2018-01-16 15:11:23 +00:00
ADD CONSTRAINT watched_contracts_pkey PRIMARY KEY (contract_id);
--
-- Name: block_id_index; Type: INDEX; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE INDEX block_id_index ON public.transactions USING btree (block_id);
2018-01-16 15:11:23 +00:00
--
-- Name: block_number_index; Type: INDEX; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE INDEX block_number_index ON public.blocks USING btree (number);
2018-01-16 15:11:23 +00:00
--
-- Name: node_id_index; Type: INDEX; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE INDEX node_id_index ON public.blocks USING btree (eth_node_id);
2018-01-16 15:11:23 +00:00
--
-- Name: tx_from_index; Type: INDEX; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE INDEX tx_from_index ON public.transactions USING btree (tx_from);
2018-01-16 15:11:23 +00:00
--
-- Name: tx_to_index; Type: INDEX; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
CREATE INDEX tx_to_index ON public.transactions USING btree (tx_to);
2018-01-16 15:11:23 +00:00
2018-08-07 15:51:34 +00:00
--
-- Name: flip_kick flip_kick_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.flip_kick
ADD CONSTRAINT flip_kick_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
2018-08-09 21:55:02 +00:00
--
-- Name: frob frob_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.frob
ADD CONSTRAINT frob_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
2018-07-24 16:38:49 +00:00
--
-- Name: peps headers_fk; Type: FK CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.peps
ADD CONSTRAINT headers_fk FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
2018-01-16 15:11:23 +00:00
--
-- Name: transactions blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
2018-01-16 15:11:23 +00:00
--
-- Name: receipts blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.receipts
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
--
-- Name: token_supply blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.token_supply
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
--
-- Name: headers eth_nodes_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.headers
ADD CONSTRAINT eth_nodes_fk FOREIGN KEY (eth_node_id) REFERENCES public.eth_nodes(id) ON DELETE CASCADE;
2018-01-16 15:11:23 +00:00
--
-- Name: blocks node_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.blocks
ADD CONSTRAINT node_fk FOREIGN KEY (eth_node_id) REFERENCES public.eth_nodes(id) ON DELETE CASCADE;
2018-01-16 15:11:23 +00:00
--
-- Name: logs receipts_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
2018-04-11 16:02:29 +00:00
ALTER TABLE ONLY public.logs
ADD CONSTRAINT receipts_fk FOREIGN KEY (receipt_id) REFERENCES public.receipts(id) ON DELETE CASCADE;
2018-01-16 15:11:23 +00:00
--
-- PostgreSQL database dump complete
--