update the pre- and post- batch sets with new meta schema and tables

This commit is contained in:
i-norden 2022-03-31 12:45:27 -05:00
parent 82f28ae6ba
commit 201cadbd49
13 changed files with 75 additions and 43 deletions

View File

@ -1,10 +1,10 @@
-- +goose Up
CREATE TABLE eth.known_gaps (
starting_block_number bigint PRIMARY KEY,
ending_block_number bigint,
checked_out boolean,
processing_key bigint
CREATE TABLE eth_meta.known_gaps (
starting_block_number bigint PRIMARY KEY,
ending_block_number bigint,
checked_out boolean,
processing_key bigint
);
-- +goose Down
DROP TABLE eth.known_gaps;
DROP TABLE eth_meta.known_gaps;

View File

@ -1,4 +1,16 @@
-- +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);
@ -35,3 +47,15 @@ DROP CONSTRAINT pk_eth_access_list_elements;
ALTER TABLE eth.receipt_cids
DROP CONSTRAINT pk_eth_receipt_cids;
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;

View File

@ -1,25 +0,0 @@
-- +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;

View File

@ -0,0 +1,5 @@
-- +goose Up
CREATE SCHEMA eth_meta;
-- +goose Down
DROP SCHEMA eth_meta;

View File

@ -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;

View File

@ -0,0 +1,10 @@
-- +goose Up
CREATE TABLE eth_meta.known_gaps (
starting_block_number bigint PRIMARY KEY,
ending_block_number bigint,
checked_out boolean,
processing_key bigint
);
-- +goose Down
DROP TABLE eth_meta.known_gaps;

View File

@ -409,6 +409,18 @@ CREATE TABLE eth.uncle_cids (
);
--
-- Name: known_gaps; Type: TABLE; Schema: eth_meta; Owner: -
--
CREATE TABLE eth_meta.known_gaps (
starting_block_number bigint NOT NULL,
ending_block_number bigint,
checked_out boolean,
processing_key bigint
);
--
-- Name: watched_addresses; Type: TABLE; Schema: eth_meta; Owner: -
--
@ -488,18 +500,6 @@ CREATE TABLE public.nodes (
);
--
-- Name: known_gaps; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE eth.known_gaps (
starting_block_number bigint PRIMARY KEY,
ending_block_number bigint,
checked_out boolean,
processing_key bigint
);
--
-- Name: TABLE nodes; Type: COMMENT; Schema: public; Owner: -
--
@ -593,6 +593,14 @@ ALTER TABLE ONLY eth.uncle_cids
ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (block_hash);
--
-- Name: known_gaps known_gaps_pkey; Type: CONSTRAINT; Schema: eth_meta; Owner: -
--
ALTER TABLE ONLY eth_meta.known_gaps
ADD CONSTRAINT known_gaps_pkey PRIMARY KEY (starting_block_number);
--
-- Name: watched_addresses watched_addresses_pkey; Type: CONSTRAINT; Schema: eth_meta; Owner: -
--