split uncles into their own table; add tx index to the tx index (lol); continue work on geth api endpoints
This commit is contained in:
@@ -5,7 +5,6 @@ CREATE TABLE public.header_cids (
|
||||
block_hash VARCHAR(66) NOT NULL,
|
||||
parent_hash VARCHAR(66) NOT NULL,
|
||||
cid TEXT NOT NULL,
|
||||
uncle BOOLEAN NOT NULL,
|
||||
td BIGINT,
|
||||
UNIQUE (block_number, block_hash)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.uncle_cids (
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
||||
block_hash VARCHAR(66) NOT NULL,
|
||||
parent_hash VARCHAR(66) NOT NULL,
|
||||
cid TEXT NOT NULL,
|
||||
UNIQUE (header_id, block_hash)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.uncle_cids;
|
||||
+1
@@ -3,6 +3,7 @@ CREATE TABLE public.transaction_cids (
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
||||
tx_hash VARCHAR(66) NOT NULL,
|
||||
index INTEGER NOT NULL,
|
||||
cid TEXT NOT NULL,
|
||||
dst VARCHAR(66) NOT NULL,
|
||||
src VARCHAR(66) NOT NULL,
|
||||
+65
-1
@@ -315,7 +315,6 @@ CREATE TABLE public.header_cids (
|
||||
block_hash character varying(66) NOT NULL,
|
||||
parent_hash character varying(66) NOT NULL,
|
||||
cid text NOT NULL,
|
||||
uncle boolean NOT NULL,
|
||||
td bigint
|
||||
);
|
||||
|
||||
@@ -728,6 +727,7 @@ CREATE TABLE public.transaction_cids (
|
||||
id integer NOT NULL,
|
||||
header_id integer NOT NULL,
|
||||
tx_hash character varying(66) NOT NULL,
|
||||
index integer NOT NULL,
|
||||
cid text NOT NULL,
|
||||
dst character varying(66) NOT NULL,
|
||||
src character varying(66) NOT NULL
|
||||
@@ -754,6 +754,39 @@ CREATE SEQUENCE public.transaction_cids_id_seq
|
||||
ALTER SEQUENCE public.transaction_cids_id_seq OWNED BY public.transaction_cids.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.uncle_cids (
|
||||
id integer NOT NULL,
|
||||
header_id integer NOT NULL,
|
||||
block_hash character varying(66) NOT NULL,
|
||||
parent_hash character varying(66) NOT NULL,
|
||||
cid text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.uncle_cids_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.uncle_cids_id_seq OWNED BY public.uncle_cids.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncles; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1016,6 +1049,13 @@ ALTER TABLE ONLY public.storage_diff ALTER COLUMN id SET DEFAULT nextval('public
|
||||
ALTER TABLE ONLY public.transaction_cids ALTER COLUMN id SET DEFAULT nextval('public.transaction_cids_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.uncle_cids ALTER COLUMN id SET DEFAULT nextval('public.uncle_cids_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncles id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1317,6 +1357,22 @@ ALTER TABLE ONLY public.transaction_cids
|
||||
ADD CONSTRAINT transaction_cids_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids uncle_cids_header_id_block_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.uncle_cids
|
||||
ADD CONSTRAINT uncle_cids_header_id_block_hash_key UNIQUE (header_id, block_hash);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids uncle_cids_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.uncle_cids
|
||||
ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncles uncles_block_id_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -1578,6 +1634,14 @@ ALTER TABLE ONLY public.transaction_cids
|
||||
ADD CONSTRAINT transaction_cids_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.header_cids(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncle_cids uncle_cids_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.uncle_cids
|
||||
ADD CONSTRAINT uncle_cids_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.header_cids(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
|
||||
--
|
||||
-- Name: uncles uncles_block_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user