Add receipts (#119)
* Conversion between Geth Receipt and core.Receipt * Add receipt to DB * Insert receipts with transactions * Update Travis CI to use dep for dependencies
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DROP TABLE receipts;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE receipts
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
transaction_id INTEGER NOT NULL,
|
||||
contract_address VARCHAR(42),
|
||||
cumulative_gas_used NUMERIC,
|
||||
gas_used NUMERIC,
|
||||
state_root VARCHAR(66),
|
||||
status INTEGER,
|
||||
tx_hash VARCHAR(66),
|
||||
CONSTRAINT transaction_fk FOREIGN KEY (transaction_id)
|
||||
REFERENCES transactions (id)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX transaction_id_index;
|
||||
@@ -0,0 +1 @@
|
||||
CREATE INDEX transaction_id_index ON receipts (transaction_id);
|
||||
@@ -145,6 +145,41 @@ CREATE SEQUENCE nodes_id_seq
|
||||
ALTER SEQUENCE nodes_id_seq OWNED BY nodes.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: receipts; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE receipts (
|
||||
id integer NOT NULL,
|
||||
transaction_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)
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: receipts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE receipts_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: receipts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE receipts_id_seq OWNED BY receipts.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -243,6 +278,13 @@ ALTER TABLE ONLY logs ALTER COLUMN id SET DEFAULT nextval('logs_id_seq'::regclas
|
||||
ALTER TABLE ONLY nodes ALTER COLUMN id SET DEFAULT nextval('nodes_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: receipts id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY receipts ALTER COLUMN id SET DEFAULT nextval('receipts_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -313,6 +355,14 @@ ALTER TABLE ONLY nodes
|
||||
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: receipts receipts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY receipts
|
||||
ADD CONSTRAINT receipts_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -358,6 +408,13 @@ CREATE INDEX block_number_index ON blocks USING btree (block_number);
|
||||
CREATE INDEX node_id_index ON blocks USING btree (node_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: transaction_id_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX transaction_id_index ON receipts USING btree (transaction_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: tx_from_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@@ -388,6 +445,14 @@ ALTER TABLE ONLY blocks
|
||||
ADD CONSTRAINT node_fk FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: receipts transaction_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY receipts
|
||||
ADD CONSTRAINT transaction_fk FOREIGN KEY (transaction_id) REFERENCES transactions(id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user