Make check_count a column on public.headers
- Don't need to maintain it on public.checked_headers if we're not adding additional columns to that table
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.headers (
|
||||
id SERIAL PRIMARY KEY,
|
||||
hash VARCHAR(66),
|
||||
block_number BIGINT,
|
||||
raw JSONB,
|
||||
block_timestamp NUMERIC,
|
||||
eth_node_id INTEGER NOT NULL REFERENCES eth_nodes (id) ON DELETE CASCADE,
|
||||
eth_node_fingerprint VARCHAR(128)
|
||||
CREATE TABLE public.headers
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
hash VARCHAR(66),
|
||||
block_number BIGINT,
|
||||
raw JSONB,
|
||||
block_timestamp NUMERIC,
|
||||
check_count INTEGER NOT NULL DEFAULT 0,
|
||||
eth_node_id INTEGER NOT NULL REFERENCES eth_nodes (id) ON DELETE CASCADE,
|
||||
eth_node_fingerprint VARCHAR(128)
|
||||
);
|
||||
|
||||
-- Index is removed when table is
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.checked_headers
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||
check_count INTEGER NOT NULL DEFAULT 1
|
||||
CREATE TABLE public.checked_headers (
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ CREATE TABLE public.checked_logs
|
||||
|
||||
-- +goose Down
|
||||
-- SQL in this section is executed when the migration is rolled back.
|
||||
DROP TABLE public.checked_logs;
|
||||
DROP TABLE public.checked_logs;
|
||||
+2
-2
@@ -131,8 +131,7 @@ ALTER SEQUENCE public.blocks_id_seq OWNED BY public.blocks.id;
|
||||
|
||||
CREATE TABLE public.checked_headers (
|
||||
id integer NOT NULL,
|
||||
header_id integer NOT NULL,
|
||||
check_count integer DEFAULT 1 NOT NULL
|
||||
header_id integer NOT NULL
|
||||
);
|
||||
|
||||
|
||||
@@ -456,6 +455,7 @@ CREATE TABLE public.headers (
|
||||
block_number bigint,
|
||||
raw jsonb,
|
||||
block_timestamp numeric,
|
||||
check_count integer DEFAULT 0 NOT NULL,
|
||||
eth_node_id integer NOT NULL,
|
||||
eth_node_fingerprint character varying(128)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user