forked from cerc-io/ipld-eth-server
trimming down to ipfs watchers
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.addresses
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
address character varying(42),
|
||||
hashed_address character varying(66),
|
||||
UNIQUE (address)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.addresses;
|
||||
@@ -1,25 +0,0 @@
|
||||
-- +goose Up
|
||||
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,
|
||||
node_id INTEGER NOT NULL REFERENCES nodes (id) ON DELETE CASCADE,
|
||||
eth_node_fingerprint VARCHAR(128),
|
||||
UNIQUE (block_number, hash, eth_node_fingerprint)
|
||||
);
|
||||
|
||||
CREATE INDEX headers_block_number
|
||||
ON public.headers (block_number);
|
||||
|
||||
CREATE INDEX headers_block_timestamp
|
||||
ON public.headers (block_timestamp);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX public.headers_block_number;
|
||||
DROP INDEX public.headers_block_timestamp;
|
||||
|
||||
DROP TABLE public.headers;
|
||||
@@ -1,8 +0,0 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.checked_headers (
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.checked_headers;
|
||||
@@ -1,14 +0,0 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.storage_diff
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_height BIGINT,
|
||||
block_hash BYTEA,
|
||||
hashed_address BYTEA,
|
||||
storage_key BYTEA,
|
||||
storage_value BYTEA,
|
||||
UNIQUE (block_height, block_hash, hashed_address, storage_key, storage_value)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.storage_diff;
|
||||
@@ -1,9 +0,0 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.queued_storage
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
diff_id BIGINT UNIQUE NOT NULL REFERENCES public.storage_diff (id)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.queued_storage;
|
||||
@@ -1,29 +0,0 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE public.header_sync_transactions
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||
hash VARCHAR(66),
|
||||
gas_limit NUMERIC,
|
||||
gas_price NUMERIC,
|
||||
input_data BYTEA,
|
||||
nonce NUMERIC,
|
||||
raw BYTEA,
|
||||
tx_from VARCHAR(44),
|
||||
tx_index INTEGER,
|
||||
tx_to VARCHAR(44),
|
||||
"value" NUMERIC,
|
||||
UNIQUE (header_id, hash)
|
||||
);
|
||||
|
||||
CREATE INDEX header_sync_transactions_header
|
||||
ON public.header_sync_transactions (header_id);
|
||||
|
||||
CREATE INDEX header_sync_transactions_tx_index
|
||||
ON public.header_sync_transactions (tx_index);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX public.header_sync_transactions_header;
|
||||
DROP INDEX public.header_sync_transactions_tx_index;
|
||||
|
||||
DROP TABLE header_sync_transactions;
|
||||
@@ -1,27 +0,0 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE header_sync_receipts
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
transaction_id INTEGER NOT NULL REFERENCES header_sync_transactions (id) ON DELETE CASCADE,
|
||||
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||
contract_address_id INTEGER NOT NULL REFERENCES addresses (id) ON DELETE CASCADE,
|
||||
cumulative_gas_used NUMERIC,
|
||||
gas_used NUMERIC,
|
||||
state_root VARCHAR(66),
|
||||
status INTEGER,
|
||||
tx_hash VARCHAR(66),
|
||||
rlp BYTEA,
|
||||
UNIQUE (header_id, transaction_id)
|
||||
);
|
||||
|
||||
CREATE INDEX header_sync_receipts_header
|
||||
ON public.header_sync_receipts (header_id);
|
||||
|
||||
CREATE INDEX header_sync_receipts_transaction
|
||||
ON public.header_sync_receipts (transaction_id);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX public.header_sync_receipts_header;
|
||||
DROP INDEX public.header_sync_receipts_transaction;
|
||||
|
||||
DROP TABLE header_sync_receipts;
|
||||
@@ -1,22 +0,0 @@
|
||||
-- +goose Up
|
||||
-- SQL in this section is executed when the migration is applied.
|
||||
CREATE TABLE header_sync_logs
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||
address INTEGER NOT NULL REFERENCES addresses (id) ON DELETE CASCADE,
|
||||
topics BYTEA[],
|
||||
data BYTEA,
|
||||
block_number BIGINT,
|
||||
block_hash VARCHAR(66),
|
||||
tx_hash VARCHAR(66),
|
||||
tx_index INTEGER,
|
||||
log_index INTEGER,
|
||||
raw JSONB,
|
||||
transformed BOOL NOT NULL DEFAULT FALSE,
|
||||
UNIQUE (header_id, tx_index, log_index)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
-- SQL in this section is executed when the migration is rolled back.
|
||||
DROP TABLE header_sync_logs;
|
||||
@@ -1,12 +0,0 @@
|
||||
-- +goose Up
|
||||
-- SQL in this section is executed when the migration is applied.
|
||||
CREATE TABLE public.watched_logs
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
contract_address VARCHAR(42),
|
||||
topic_zero VARCHAR(66)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
-- SQL in this section is executed when the migration is rolled back.
|
||||
DROP TABLE public.watched_logs;
|
||||
-2
@@ -6,8 +6,6 @@ COMMENT ON TABLE btc.queue_data IS E'@name BtcQueueData';
|
||||
COMMENT ON TABLE eth.transaction_cids IS E'@name EthTransactionCids';
|
||||
COMMENT ON TABLE eth.header_cids IS E'@name EthHeaderCids';
|
||||
COMMENT ON TABLE eth.queue_data IS E'@name EthQueueData';
|
||||
COMMENT ON TABLE public.headers IS E'@name EthHeaders';
|
||||
COMMENT ON COLUMN public.headers.node_id IS E'@name EthNodeID';
|
||||
COMMENT ON COLUMN public.nodes.node_id IS E'@name ChainNodeID';
|
||||
COMMENT ON COLUMN eth.header_cids.node_id IS E'@name EthNodeID';
|
||||
COMMENT ON COLUMN btc.header_cids.node_id IS E'@name BtcNodeID';
|
||||
Reference in New Issue
Block a user