From ad7e1dc47dba983426709eab000bec65ab629eda Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 1 Sep 2023 17:39:19 +0800 Subject: [PATCH] rm db/migrations --- .../00001_create_ipfs_blocks_table.sql | 8 ------- db/migrations/00002_create_nodes_table.sql | 12 ---------- db/migrations/00003_create_eth_schema.sql | 5 ---- .../00004_create_eth_header_cids_table.sql | 23 ------------------- .../00005_create_eth_uncle_cids_table.sql | 14 ----------- ...0006_create_eth_transaction_cids_table.sql | 15 ------------ .../00007_create_eth_receipt_cids_table.sql | 18 --------------- .../00008_create_eth_state_cids_table.sql | 15 ------------ .../00009_create_eth_storage_cids_table.sql | 15 ------------ .../00010_create_eth_state_accouts_table.sql | 13 ----------- 10 files changed, 138 deletions(-) delete mode 100644 db/migrations/00001_create_ipfs_blocks_table.sql delete mode 100644 db/migrations/00002_create_nodes_table.sql delete mode 100644 db/migrations/00003_create_eth_schema.sql delete mode 100644 db/migrations/00004_create_eth_header_cids_table.sql delete mode 100644 db/migrations/00005_create_eth_uncle_cids_table.sql delete mode 100644 db/migrations/00006_create_eth_transaction_cids_table.sql delete mode 100644 db/migrations/00007_create_eth_receipt_cids_table.sql delete mode 100644 db/migrations/00008_create_eth_state_cids_table.sql delete mode 100644 db/migrations/00009_create_eth_storage_cids_table.sql delete mode 100644 db/migrations/00010_create_eth_state_accouts_table.sql diff --git a/db/migrations/00001_create_ipfs_blocks_table.sql b/db/migrations/00001_create_ipfs_blocks_table.sql deleted file mode 100644 index 6e3941e..0000000 --- a/db/migrations/00001_create_ipfs_blocks_table.sql +++ /dev/null @@ -1,8 +0,0 @@ --- +goose Up -CREATE TABLE IF NOT EXISTS public.blocks ( - key TEXT UNIQUE NOT NULL, - data BYTEA NOT NULL -); - --- +goose Down -DROP TABLE public.blocks; diff --git a/db/migrations/00002_create_nodes_table.sql b/db/migrations/00002_create_nodes_table.sql deleted file mode 100644 index 76db3d7..0000000 --- a/db/migrations/00002_create_nodes_table.sql +++ /dev/null @@ -1,12 +0,0 @@ --- +goose Up -CREATE TABLE nodes ( - id SERIAL PRIMARY KEY, - client_name VARCHAR, - genesis_block VARCHAR(66), - network_id VARCHAR, - node_id VARCHAR(128), - CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id) -); - --- +goose Down -DROP TABLE nodes; diff --git a/db/migrations/00003_create_eth_schema.sql b/db/migrations/00003_create_eth_schema.sql deleted file mode 100644 index 84d6f4b..0000000 --- a/db/migrations/00003_create_eth_schema.sql +++ /dev/null @@ -1,5 +0,0 @@ --- +goose Up -CREATE SCHEMA eth; - --- +goose Down -DROP SCHEMA eth; \ No newline at end of file diff --git a/db/migrations/00004_create_eth_header_cids_table.sql b/db/migrations/00004_create_eth_header_cids_table.sql deleted file mode 100644 index 339eb42..0000000 --- a/db/migrations/00004_create_eth_header_cids_table.sql +++ /dev/null @@ -1,23 +0,0 @@ --- +goose Up -CREATE TABLE eth.header_cids ( - id SERIAL PRIMARY KEY, - block_number BIGINT NOT NULL, - block_hash VARCHAR(66) NOT NULL, - parent_hash VARCHAR(66) NOT NULL, - cid TEXT NOT NULL, - mh_key TEXT NOT NULL REFERENCES public.blocks (key) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - td NUMERIC NOT NULL, - node_id INTEGER NOT NULL REFERENCES nodes (id) ON DELETE CASCADE, - reward NUMERIC NOT NULL, - state_root VARCHAR(66) NOT NULL, - tx_root VARCHAR(66) NOT NULL, - receipt_root VARCHAR(66) NOT NULL, - uncle_root VARCHAR(66) NOT NULL, - bloom BYTEA NOT NULL, - timestamp NUMERIC NOT NULL, - times_validated INTEGER NOT NULL DEFAULT 1, - UNIQUE (block_number, block_hash) -); - --- +goose Down -DROP TABLE eth.header_cids; \ No newline at end of file diff --git a/db/migrations/00005_create_eth_uncle_cids_table.sql b/db/migrations/00005_create_eth_uncle_cids_table.sql deleted file mode 100644 index c46cafb..0000000 --- a/db/migrations/00005_create_eth_uncle_cids_table.sql +++ /dev/null @@ -1,14 +0,0 @@ --- +goose Up -CREATE TABLE eth.uncle_cids ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES eth.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, - mh_key TEXT NOT NULL REFERENCES public.blocks (key) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - reward NUMERIC NOT NULL, - UNIQUE (header_id, block_hash) -); - --- +goose Down -DROP TABLE eth.uncle_cids; \ No newline at end of file diff --git a/db/migrations/00006_create_eth_transaction_cids_table.sql b/db/migrations/00006_create_eth_transaction_cids_table.sql deleted file mode 100644 index cbbef78..0000000 --- a/db/migrations/00006_create_eth_transaction_cids_table.sql +++ /dev/null @@ -1,15 +0,0 @@ --- +goose Up -CREATE TABLE eth.transaction_cids ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES eth.header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - tx_hash VARCHAR(66) NOT NULL, - index INTEGER NOT NULL, - cid TEXT NOT NULL, - mh_key TEXT NOT NULL REFERENCES public.blocks (key) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - dst VARCHAR(66) NOT NULL, - src VARCHAR(66) NOT NULL, - UNIQUE (header_id, tx_hash) -); - --- +goose Down -DROP TABLE eth.transaction_cids; diff --git a/db/migrations/00007_create_eth_receipt_cids_table.sql b/db/migrations/00007_create_eth_receipt_cids_table.sql deleted file mode 100644 index 5d4ae0c..0000000 --- a/db/migrations/00007_create_eth_receipt_cids_table.sql +++ /dev/null @@ -1,18 +0,0 @@ --- +goose Up -CREATE TABLE eth.receipt_cids ( - id SERIAL PRIMARY KEY, - tx_id INTEGER NOT NULL REFERENCES eth.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - cid TEXT NOT NULL, - mh_key TEXT NOT NULL REFERENCES public.blocks (key) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - contract VARCHAR(66), - contract_hash VARCHAR(66), - topic0s VARCHAR(66)[], - topic1s VARCHAR(66)[], - topic2s VARCHAR(66)[], - topic3s VARCHAR(66)[], - log_contracts VARCHAR(66)[], - UNIQUE (tx_id) -); - --- +goose Down -DROP TABLE eth.receipt_cids; \ No newline at end of file diff --git a/db/migrations/00008_create_eth_state_cids_table.sql b/db/migrations/00008_create_eth_state_cids_table.sql deleted file mode 100644 index e0bf6e5..0000000 --- a/db/migrations/00008_create_eth_state_cids_table.sql +++ /dev/null @@ -1,15 +0,0 @@ --- +goose Up -CREATE TABLE eth.state_cids ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES eth.header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - state_leaf_key VARCHAR(66), - cid TEXT NOT NULL, - mh_key TEXT NOT NULL REFERENCES public.blocks (key) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - state_path BYTEA, - node_type INTEGER, - diff BOOLEAN NOT NULL DEFAULT FALSE, - UNIQUE (header_id, state_path) -); - --- +goose Down -DROP TABLE eth.state_cids; \ No newline at end of file diff --git a/db/migrations/00009_create_eth_storage_cids_table.sql b/db/migrations/00009_create_eth_storage_cids_table.sql deleted file mode 100644 index 944d39e..0000000 --- a/db/migrations/00009_create_eth_storage_cids_table.sql +++ /dev/null @@ -1,15 +0,0 @@ --- +goose Up -CREATE TABLE eth.storage_cids ( - id SERIAL PRIMARY KEY, - state_id INTEGER NOT NULL REFERENCES eth.state_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - storage_leaf_key VARCHAR(66), - cid TEXT NOT NULL, - mh_key TEXT NOT NULL REFERENCES public.blocks (key) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - storage_path BYTEA, - node_type INTEGER NOT NULL, - diff BOOLEAN NOT NULL DEFAULT FALSE, - UNIQUE (state_id, storage_path) -); - --- +goose Down -DROP TABLE eth.storage_cids; \ No newline at end of file diff --git a/db/migrations/00010_create_eth_state_accouts_table.sql b/db/migrations/00010_create_eth_state_accouts_table.sql deleted file mode 100644 index 322d948..0000000 --- a/db/migrations/00010_create_eth_state_accouts_table.sql +++ /dev/null @@ -1,13 +0,0 @@ --- +goose Up -CREATE TABLE eth.state_accounts ( - id SERIAL PRIMARY KEY, - state_id INTEGER NOT NULL REFERENCES eth.state_cids (id) ON DELETE CASCADE, - balance NUMERIC NOT NULL, - nonce INTEGER NOT NULL, - code_hash BYTEA NOT NULL, - storage_root VARCHAR(66) NOT NULL, - UNIQUE (state_id) -); - --- +goose Down -DROP TABLE eth.state_accounts; \ No newline at end of file