move eth tables under eth schema

This commit is contained in:
Ian Norden
2020-02-20 16:14:17 -06:00
parent 4dde90447e
commit 9018e551ba
13 changed files with 442 additions and 423 deletions
@@ -0,0 +1,5 @@
-- +goose Up
CREATE SCHEMA eth;
-- +goose Down
DROP SCHEMA eth;
@@ -1,5 +1,5 @@
-- +goose Up
CREATE TABLE public.header_cids (
CREATE TABLE eth.header_cids (
id SERIAL PRIMARY KEY,
block_number BIGINT NOT NULL,
block_hash VARCHAR(66) NOT NULL,
@@ -10,4 +10,4 @@ CREATE TABLE public.header_cids (
);
-- +goose Down
DROP TABLE public.header_cids;
DROP TABLE eth.header_cids;
@@ -1,7 +1,7 @@
-- +goose Up
CREATE TABLE public.uncle_cids (
CREATE TABLE eth.uncle_cids (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
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,
@@ -9,4 +9,4 @@ CREATE TABLE public.uncle_cids (
);
-- +goose Down
DROP TABLE public.uncle_cids;
DROP TABLE eth.uncle_cids;
@@ -1,7 +1,7 @@
-- +goose Up
CREATE TABLE public.transaction_cids (
CREATE TABLE eth.transaction_cids (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
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,
@@ -11,4 +11,4 @@ CREATE TABLE public.transaction_cids (
);
-- +goose Down
DROP TABLE public.transaction_cids;
DROP TABLE eth.transaction_cids;
@@ -1,7 +1,7 @@
-- +goose Up
CREATE TABLE public.receipt_cids (
CREATE TABLE eth.receipt_cids (
id SERIAL PRIMARY KEY,
tx_id INTEGER NOT NULL REFERENCES transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
tx_id INTEGER NOT NULL REFERENCES eth.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
cid TEXT NOT NULL,
contract VARCHAR(66),
topic0s VARCHAR(66)[],
@@ -11,4 +11,4 @@ CREATE TABLE public.receipt_cids (
);
-- +goose Down
DROP TABLE public.receipt_cids;
DROP TABLE eth.receipt_cids;
@@ -1,7 +1,7 @@
-- +goose Up
CREATE TABLE public.state_cids (
CREATE TABLE eth.state_cids (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
header_id INTEGER NOT NULL REFERENCES eth.header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
state_key VARCHAR(66) NOT NULL,
leaf BOOLEAN NOT NULL,
cid TEXT NOT NULL,
@@ -9,4 +9,4 @@ CREATE TABLE public.state_cids (
);
-- +goose Down
DROP TABLE public.state_cids;
DROP TABLE eth.state_cids;
@@ -1,7 +1,7 @@
-- +goose Up
CREATE TABLE public.storage_cids (
CREATE TABLE eth.storage_cids (
id SERIAL PRIMARY KEY,
state_id INTEGER NOT NULL REFERENCES state_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
state_id INTEGER NOT NULL REFERENCES eth.state_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
storage_key VARCHAR(66) NOT NULL,
leaf BOOLEAN NOT NULL,
cid TEXT NOT NULL,
@@ -9,4 +9,4 @@ CREATE TABLE public.storage_cids (
);
-- +goose Down
DROP TABLE public.storage_cids;
DROP TABLE eth.storage_cids;