Rename transactions to full_sync_transactions
- Table has foreign key to blocks - Add transaction RLP and transaction index to table - Enables other tables with standalone transactions or transactions associated with other data structures (e.g. headers)
This commit is contained in:
+66
-64
@@ -151,6 +151,46 @@ CREATE TABLE public.eth_nodes (
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: full_sync_transactions; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.full_sync_transactions (
|
||||
id integer NOT NULL,
|
||||
block_id integer NOT NULL,
|
||||
gaslimit numeric,
|
||||
gasprice numeric,
|
||||
hash character varying(66),
|
||||
input_data character varying,
|
||||
nonce numeric,
|
||||
raw bytea,
|
||||
tx_from character varying(66),
|
||||
tx_index integer,
|
||||
tx_to character varying(66),
|
||||
value numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: full_sync_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.full_sync_transactions_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: full_sync_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.full_sync_transactions_id_seq OWNED BY public.full_sync_transactions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: goose_db_version; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -368,44 +408,6 @@ CREATE SEQUENCE public.receipts_id_seq
|
||||
ALTER SEQUENCE public.receipts_id_seq OWNED BY public.receipts.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.transactions (
|
||||
id integer NOT NULL,
|
||||
block_id integer NOT NULL,
|
||||
input_data character varying,
|
||||
tx_from character varying(66),
|
||||
gaslimit numeric,
|
||||
gasprice numeric,
|
||||
hash character varying(66),
|
||||
nonce numeric,
|
||||
tx_to character varying(66),
|
||||
value numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.transactions_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: watched_contracts; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -481,6 +483,13 @@ ALTER TABLE ONLY public.checked_headers ALTER COLUMN id SET DEFAULT nextval('pub
|
||||
ALTER TABLE ONLY public.eth_nodes ALTER COLUMN id SET DEFAULT nextval('public.nodes_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: full_sync_transactions id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.full_sync_transactions ALTER COLUMN id SET DEFAULT nextval('public.full_sync_transactions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: goose_db_version id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -523,13 +532,6 @@ ALTER TABLE ONLY public.queued_storage ALTER COLUMN id SET DEFAULT nextval('publ
|
||||
ALTER TABLE ONLY public.receipts ALTER COLUMN id SET DEFAULT nextval('public.receipts_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: watched_contracts contract_id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -577,6 +579,14 @@ ALTER TABLE ONLY public.eth_nodes
|
||||
ADD CONSTRAINT eth_node_uc UNIQUE (genesis_block, network_id, eth_node_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: full_sync_transactions full_sync_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.full_sync_transactions
|
||||
ADD CONSTRAINT full_sync_transactions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: goose_db_version goose_db_version_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -633,14 +643,6 @@ ALTER TABLE ONLY public.receipts
|
||||
ADD CONSTRAINT receipts_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.transactions
|
||||
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: watched_contracts watched_contracts_contract_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -661,7 +663,7 @@ ALTER TABLE ONLY public.watched_contracts
|
||||
-- Name: block_id_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX block_id_index ON public.transactions USING btree (block_id);
|
||||
CREATE INDEX block_id_index ON public.full_sync_transactions USING btree (block_id);
|
||||
|
||||
|
||||
--
|
||||
@@ -689,14 +691,14 @@ CREATE INDEX number_index ON public.blocks USING btree (number);
|
||||
-- Name: tx_from_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX tx_from_index ON public.transactions USING btree (tx_from);
|
||||
CREATE INDEX tx_from_index ON public.full_sync_transactions USING btree (tx_from);
|
||||
|
||||
|
||||
--
|
||||
-- Name: tx_to_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX tx_to_index ON public.transactions USING btree (tx_to);
|
||||
CREATE INDEX tx_to_index ON public.full_sync_transactions USING btree (tx_to);
|
||||
|
||||
|
||||
--
|
||||
@@ -723,6 +725,14 @@ ALTER TABLE ONLY public.headers
|
||||
ADD CONSTRAINT eth_nodes_fk FOREIGN KEY (eth_node_id) REFERENCES public.eth_nodes(id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: full_sync_transactions full_sync_transactions_block_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.full_sync_transactions
|
||||
ADD CONSTRAINT full_sync_transactions_block_id_fkey FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: blocks node_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -739,14 +749,6 @@ ALTER TABLE ONLY public.logs
|
||||
ADD CONSTRAINT receipts_fk FOREIGN KEY (receipt_id) REFERENCES public.receipts(id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: transactions transactions_block_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.transactions
|
||||
ADD CONSTRAINT transactions_block_id_fkey FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user