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/00018_create_watched_addresses_table.sql b/db/migrations/00018_create_watched_addresses_table.sql new file mode 100644 index 0000000..a8f009f --- /dev/null +++ b/db/migrations/00018_create_watched_addresses_table.sql @@ -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; diff --git a/schema.sql b/schema.sql index d23164d..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 = ''; -- @@ -552,6 +559,18 @@ 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_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: - -- @@ -863,6 +882,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_meta; Owner: - +-- + +ALTER TABLE ONLY eth_meta.watched_addresses + ADD CONSTRAINT watched_addresses_pkey PRIMARY KEY (address); + + -- -- Name: blocks blocks_key_key; Type: CONSTRAINT; Schema: public; Owner: - --