Skip to content

Commit

Permalink
Merge pull request #54 from deep-stack/ng-watched-addresses-v3
Browse files Browse the repository at this point in the history
Add a table for watched addresses (v3)
  • Loading branch information
i-norden authored Mar 23, 2022
2 parents bba8a41 + 679f3e8 commit d8dbd14
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions db/migrations/00019_create_eth_meta_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- +goose Up
CREATE SCHEMA eth_meta;

-- +goose Down
DROP SCHEMA eth_meta;
10 changes: 10 additions & 0 deletions db/migrations/00020_create_watched_addresses_table.sql
Original file line number Diff line number Diff line change
@@ -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;
27 changes: 27 additions & 0 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: -
--
Expand Down Expand Up @@ -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: -
--
Expand Down

0 comments on commit d8dbd14

Please sign in to comment.