From e05942ec170fe06365cc7de5c54438585116a8b5 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Thu, 13 Jan 2022 18:52:26 +0530 Subject: [PATCH 1/5] Add table for watched addresses in eth schema --- .../00017_create_watched_addresses_table.sql | 8 ++++++++ schema.sql | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 db/migrations/00017_create_watched_addresses_table.sql diff --git a/db/migrations/00017_create_watched_addresses_table.sql b/db/migrations/00017_create_watched_addresses_table.sql new file mode 100644 index 0000000..dbf4849 --- /dev/null +++ b/db/migrations/00017_create_watched_addresses_table.sql @@ -0,0 +1,8 @@ +-- +goose Up +CREATE TABLE eth.watched_addresses ( + address VARCHAR(66) PRIMARY KEY, + added_at BIGINT NOT NULL +); + +-- +goose Down +DROP TABLE eth.watched_addresses; diff --git a/schema.sql b/schema.sql index d23164d..12a77da 100644 --- a/schema.sql +++ b/schema.sql @@ -552,6 +552,16 @@ CREATE SEQUENCE eth.uncle_cids_id_seq ALTER SEQUENCE eth.uncle_cids_id_seq OWNED BY eth.uncle_cids.id; +-- +-- Name: watched_addresses; Type: TABLE; Schema: eth; Owner: - +-- + +CREATE TABLE eth.watched_addresses ( + address character varying(66) NOT NULL, + added_at bigint NOT NULL +); + + -- -- Name: blocks; Type: TABLE; Schema: public; Owner: - -- @@ -863,6 +873,14 @@ ALTER TABLE ONLY eth.uncle_cids ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (id); +-- +-- Name: watched_addresses watched_addresses_pkey; Type: CONSTRAINT; Schema: eth; Owner: - +-- + +ALTER TABLE ONLY eth.watched_addresses + ADD CONSTRAINT watched_addresses_pkey PRIMARY KEY (address); + + -- -- Name: blocks blocks_key_key; Type: CONSTRAINT; Schema: public; Owner: - -- From 61a4cea80ba7e515d0142b97676f2d8984299dc5 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Tue, 18 Jan 2022 14:55:04 +0530 Subject: [PATCH 2/5] Update watched addresses table to track gap filling --- db/migrations/00017_create_watched_addresses_table.sql | 6 ++++-- schema.sql | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/db/migrations/00017_create_watched_addresses_table.sql b/db/migrations/00017_create_watched_addresses_table.sql index dbf4849..2a2e24e 100644 --- a/db/migrations/00017_create_watched_addresses_table.sql +++ b/db/migrations/00017_create_watched_addresses_table.sql @@ -1,7 +1,9 @@ -- +goose Up CREATE TABLE eth.watched_addresses ( - address VARCHAR(66) PRIMARY KEY, - added_at BIGINT NOT NULL + 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 diff --git a/schema.sql b/schema.sql index 12a77da..b0f9fd6 100644 --- a/schema.sql +++ b/schema.sql @@ -558,7 +558,9 @@ ALTER SEQUENCE eth.uncle_cids_id_seq OWNED BY eth.uncle_cids.id; CREATE TABLE eth.watched_addresses ( address character varying(66) NOT NULL, - added_at bigint NOT NULL + created_at bigint NOT NULL, + watched_at bigint NOT NULL, + last_filled_at bigint DEFAULT 0 NOT NULL ); From 79c852d949f3800fd858d853ef97e57de623d770 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Wed, 19 Jan 2022 16:04:46 +0530 Subject: [PATCH 3/5] Add kind column in table for watched addresses --- db/migrations/00017_create_watched_addresses_table.sql | 1 + schema.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/db/migrations/00017_create_watched_addresses_table.sql b/db/migrations/00017_create_watched_addresses_table.sql index 2a2e24e..06d735b 100644 --- a/db/migrations/00017_create_watched_addresses_table.sql +++ b/db/migrations/00017_create_watched_addresses_table.sql @@ -1,6 +1,7 @@ -- +goose Up CREATE TABLE eth.watched_addresses ( address VARCHAR(66) PRIMARY KEY, + kind INTEGER NULL NULL, created_at BIGINT NOT NULL, watched_at BIGINT NOT NULL, last_filled_at BIGINT NOT NULL DEFAULT 0 diff --git a/schema.sql b/schema.sql index b0f9fd6..9d27fcc 100644 --- a/schema.sql +++ b/schema.sql @@ -558,6 +558,7 @@ ALTER SEQUENCE eth.uncle_cids_id_seq OWNED BY eth.uncle_cids.id; CREATE TABLE eth.watched_addresses ( address character varying(66) NOT NULL, + kind integer, created_at bigint NOT NULL, watched_at bigint NOT NULL, last_filled_at bigint DEFAULT 0 NOT NULL From 174ac94752552fe7c058c0c89a05c15c24be786c Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Thu, 3 Feb 2022 10:05:19 +0530 Subject: [PATCH 4/5] Remove kind column from table for watched addresses --- db/migrations/00017_create_watched_addresses_table.sql | 1 - schema.sql | 1 - 2 files changed, 2 deletions(-) diff --git a/db/migrations/00017_create_watched_addresses_table.sql b/db/migrations/00017_create_watched_addresses_table.sql index 06d735b..2a2e24e 100644 --- a/db/migrations/00017_create_watched_addresses_table.sql +++ b/db/migrations/00017_create_watched_addresses_table.sql @@ -1,7 +1,6 @@ -- +goose Up CREATE TABLE eth.watched_addresses ( address VARCHAR(66) PRIMARY KEY, - kind INTEGER NULL NULL, created_at BIGINT NOT NULL, watched_at BIGINT NOT NULL, last_filled_at BIGINT NOT NULL DEFAULT 0 diff --git a/schema.sql b/schema.sql index 9d27fcc..b0f9fd6 100644 --- a/schema.sql +++ b/schema.sql @@ -558,7 +558,6 @@ ALTER SEQUENCE eth.uncle_cids_id_seq OWNED BY eth.uncle_cids.id; CREATE TABLE eth.watched_addresses ( address character varying(66) NOT NULL, - kind integer, created_at bigint NOT NULL, watched_at bigint NOT NULL, last_filled_at bigint DEFAULT 0 NOT NULL From c15061dee6c775139079f44bb676168e3e24fe12 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Fri, 4 Feb 2022 15:03:23 +0530 Subject: [PATCH 5/5] Move table for watched addresses to eth_meta schema --- db/migrations/00017_create_eth_meta_schema.sql | 5 +++++ ...l => 00018_create_watched_addresses_table.sql} | 4 ++-- schema.sql | 15 +++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 db/migrations/00017_create_eth_meta_schema.sql rename db/migrations/{00017_create_watched_addresses_table.sql => 00018_create_watched_addresses_table.sql} (73%) diff --git a/db/migrations/00017_create_eth_meta_schema.sql b/db/migrations/00017_create_eth_meta_schema.sql new file mode 100644 index 0000000..448cc91 --- /dev/null +++ b/db/migrations/00017_create_eth_meta_schema.sql @@ -0,0 +1,5 @@ +-- +goose Up +CREATE SCHEMA eth_meta; + +-- +goose Down +DROP SCHEMA eth_meta; diff --git a/db/migrations/00017_create_watched_addresses_table.sql b/db/migrations/00018_create_watched_addresses_table.sql similarity index 73% rename from db/migrations/00017_create_watched_addresses_table.sql rename to db/migrations/00018_create_watched_addresses_table.sql index 2a2e24e..a8f009f 100644 --- a/db/migrations/00017_create_watched_addresses_table.sql +++ b/db/migrations/00018_create_watched_addresses_table.sql @@ -1,5 +1,5 @@ -- +goose Up -CREATE TABLE eth.watched_addresses ( +CREATE TABLE eth_meta.watched_addresses ( address VARCHAR(66) PRIMARY KEY, created_at BIGINT NOT NULL, watched_at BIGINT NOT NULL, @@ -7,4 +7,4 @@ CREATE TABLE eth.watched_addresses ( ); -- +goose Down -DROP TABLE eth.watched_addresses; +DROP TABLE eth_meta.watched_addresses; diff --git a/schema.sql b/schema.sql index b0f9fd6..8b62114 100644 --- a/schema.sql +++ b/schema.sql @@ -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 = ''; -- @@ -553,10 +560,10 @@ ALTER SEQUENCE eth.uncle_cids_id_seq OWNED BY eth.uncle_cids.id; -- --- Name: watched_addresses; Type: TABLE; Schema: eth; Owner: - +-- Name: watched_addresses; Type: TABLE; Schema: eth_meta; Owner: - -- -CREATE TABLE eth.watched_addresses ( +CREATE TABLE eth_meta.watched_addresses ( address character varying(66) NOT NULL, created_at bigint NOT NULL, watched_at bigint NOT NULL, @@ -876,10 +883,10 @@ ALTER TABLE ONLY eth.uncle_cids -- --- Name: watched_addresses watched_addresses_pkey; Type: CONSTRAINT; Schema: eth; Owner: - +-- Name: watched_addresses watched_addresses_pkey; Type: CONSTRAINT; Schema: eth_meta; Owner: - -- -ALTER TABLE ONLY eth.watched_addresses +ALTER TABLE ONLY eth_meta.watched_addresses ADD CONSTRAINT watched_addresses_pkey PRIMARY KEY (address);