Compare commits

...
9 Commits
Author SHA1 Message Date
Ian Norden d8dbd14af8 Merge pull request #54 from deep-stack/ng-watched-addresses-v3
Add a table for watched addresses (v3)
2022-03-23 07:08:59 -05:00
nabarun 679f3e8d79 Remove GO111MODULE flag when installing goose in makefile
Passing GO111MODULE=off with go get throws error. The CI fails due to this when using the makefile.
2022-03-21 17:07:46 +05:30
nabarun a500c1a49a Add table for watched addresses in eth_meta schema 2022-03-17 19:02:05 +05:30
Ian Norden bba8a410f8 Merge pull request #50 from vulcanize/release-v3.0.7
Release v3.0.7
2022-03-07 11:12:09 -06:00
i-norden f59582ab42 indexes on receipt cid and mh_key should not be unique, as it is possible (but improbable) that two receipts can be identical 2022-02-16 14:11:23 -06:00
Ian Norden 16e17abb7e Merge pull request #47 from vulcanize/release-v3.0.6
split pk application into two parts
2022-01-26 13:09:24 -06:00
i-norden 9e7e0377a5 split pk application into two parts 2022-01-26 13:01:41 -06:00
Ian Norden 36de257357 Merge pull request #46 from vulcanize/release-v3.0.5
drop un-unique indexes
2022-01-25 12:33:34 -06:00
i-norden 0710ed1bb1 drop un-unique indexes 2022-01-25 12:31:59 -06:00
14 changed files with 102 additions and 50 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ BIN = $(GOPATH)/bin
## Migration tool
GOOSE = $(BIN)/goose
$(BIN)/goose:
GO111MODULE=off go get -u github.com/pressly/goose/cmd/goose
go get -u github.com/pressly/goose/cmd/goose
.PHONY: installtools
installtools: | $(GOOSE)
+4 -4
View File
@@ -1,8 +1,8 @@
-- +goose Up
-- header indexes
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid);
CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
CREATE UNIQUE INDEX header_cid_index ON eth.header_cids USING btree (cid);
CREATE UNIQUE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
CREATE INDEX timestamp_index ON eth.header_cids USING brin (timestamp);
@@ -11,8 +11,8 @@ CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
-- transaction indexes
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
CREATE UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
CREATE UNIQUE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
@@ -0,0 +1,5 @@
-- +goose Up
CREATE SCHEMA eth_meta;
-- +goose Down
DROP SCHEMA eth_meta;
@@ -0,0 +1,10 @@
-- +goose Up
CREATE TABLE eth_meta.watched_addresses (
address VARCHAR(66) PRIMARY KEY,
created_at BIGINT NOT NULL,
watched_at BIGINT NOT NULL,
last_filled_at BIGINT NOT NULL DEFAULT 0
);
-- +goose Down
DROP TABLE eth_meta.watched_addresses;
@@ -0,0 +1,9 @@
-- +goose Up
DROP INDEX eth.log_cids_index;
DROP INDEX eth.tx_tx_hash_index;
DROP INDEX eth.header_block_hash_index;
-- +goose Down
CREATE INDEX header_block_hash_index ON eth.header_cids USING btree (block_hash);
CREATE INDEX tx_tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
CREATE INDEX log_cids_index ON eth.log_cids USING btree (rct_id, index);
@@ -0,0 +1,25 @@
-- +goose Up
ALTER TABLE public.nodes
ADD CONSTRAINT pk_public_nodes PRIMARY KEY (node_id);
ALTER TABLE eth.header_cids
ADD CONSTRAINT pk_eth_header_cids PRIMARY KEY (block_hash);
ALTER TABLE eth.uncle_cids
ADD CONSTRAINT pk_eth_uncle_cids PRIMARY KEY (block_hash);
ALTER TABLE eth.transaction_cids
ADD CONSTRAINT pk_eth_transaction_cids PRIMARY KEY (tx_hash);
-- +goose Down
ALTER TABLE eth.transaction_cids
DROP CONSTRAINT pk_eth_transaction_cids;
ALTER TABLE eth.uncle_cids
DROP CONSTRAINT pk_eth_uncle_cids;
ALTER TABLE eth.header_cids
DROP CONSTRAINT pk_eth_header_cids;
ALTER TABLE public.nodes
DROP CONSTRAINT pk_public_nodes;
@@ -1,16 +1,4 @@
-- +goose Up
ALTER TABLE public.nodes
ADD CONSTRAINT pk_public_nodes PRIMARY KEY (node_id);
ALTER TABLE eth.header_cids
ADD CONSTRAINT pk_eth_header_cids PRIMARY KEY (block_hash);
ALTER TABLE eth.uncle_cids
ADD CONSTRAINT pk_eth_uncle_cids PRIMARY KEY (block_hash);
ALTER TABLE eth.transaction_cids
ADD CONSTRAINT pk_eth_transaction_cids PRIMARY KEY (tx_hash);
ALTER TABLE eth.receipt_cids
ADD CONSTRAINT pk_eth_receipt_cids PRIMARY KEY (tx_id);
@@ -30,32 +18,20 @@ ALTER TABLE eth.state_accounts
ADD CONSTRAINT pk_eth_state_accounts PRIMARY KEY (header_id, state_path);
-- +goose Down
ALTER TABLE public.nodes
DROP CONSTRAINT pk_public_nodes;
ALTER TABLE eth.header_cids
DROP CONSTRAINT pk_eth_header_cids;
ALTER TABLE eth.uncle_cids
DROP CONSTRAINT pk_eth_uncle_cids;
ALTER TABLE eth.transaction_cids
DROP CONSTRAINT pk_eth_transaction_cids;
ALTER TABLE eth.receipt_cids
DROP CONSTRAINT pk_eth_receipt_cids;
ALTER TABLE eth.access_list_elements
DROP CONSTRAINT pk_eth_access_list_elements;
ALTER TABLE eth.log_cids
DROP CONSTRAINT pk_eth_log_cids;
ALTER TABLE eth.state_cids
DROP CONSTRAINT pk_eth_state_cids;
ALTER TABLE eth.state_accounts
DROP CONSTRAINT pk_eth_state_accounts;
ALTER TABLE eth.storage_cids
DROP CONSTRAINT pk_eth_storage_cids;
ALTER TABLE eth.state_accounts
DROP CONSTRAINT pk_eth_state_accounts;
ALTER TABLE eth.state_cids
DROP CONSTRAINT pk_eth_state_cids;
ALTER TABLE eth.log_cids
DROP CONSTRAINT pk_eth_log_cids;
ALTER TABLE eth.access_list_elements
DROP CONSTRAINT pk_eth_access_list_elements;
ALTER TABLE eth.receipt_cids
DROP CONSTRAINT pk_eth_receipt_cids;
@@ -1,8 +1,8 @@
-- +goose Up
-- header indexes
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid);
CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
CREATE UNIQUE INDEX header_cid_index ON eth.header_cids USING btree (cid);
CREATE UNIQUE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
CREATE INDEX timestamp_index ON eth.header_cids USING brin (timestamp);
@@ -11,8 +11,8 @@ CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
-- transaction indexes
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
CREATE UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
CREATE UNIQUE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
+31 -4
View File
@@ -23,6 +23,13 @@ SET row_security = off;
CREATE SCHEMA eth;
--
-- Name: eth_meta; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA eth_meta;
SET default_tablespace = '';
SET default_table_access_method = heap;
@@ -402,6 +409,18 @@ CREATE TABLE eth.uncle_cids (
);
--
-- 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
);
--
-- Name: blocks; Type: TABLE; Schema: public; Owner: -
--
@@ -562,6 +581,14 @@ ALTER TABLE ONLY eth.uncle_cids
ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (block_hash);
--
-- 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);
--
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -626,14 +653,14 @@ CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
-- Name: header_cid_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid);
CREATE UNIQUE INDEX header_cid_index ON eth.header_cids USING btree (cid);
--
-- Name: header_mh_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
CREATE UNIQUE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
--
@@ -815,7 +842,7 @@ CREATE INDEX timestamp_index ON eth.header_cids USING brin ("timestamp");
-- Name: tx_cid_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
CREATE UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
--
@@ -836,7 +863,7 @@ CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
-- Name: tx_mh_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
CREATE UNIQUE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
--