Remove extraneous migration formatting

This commit is contained in:
Rob Mulholand 2019-08-26 22:11:28 -05:00
parent 666ea1c325
commit 222252f89a
17 changed files with 150 additions and 167 deletions

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE public.blocks
(
CREATE TABLE public.blocks (
id SERIAL PRIMARY KEY,
difficulty BIGINT,
extra_data VARCHAR,

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE full_sync_transactions
(
CREATE TABLE full_sync_transactions (
id SERIAL PRIMARY KEY,
block_id INTEGER NOT NULL REFERENCES blocks(id) ON DELETE CASCADE,
gas_limit NUMERIC,

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE nodes
(
CREATE TABLE nodes (
id SERIAL PRIMARY KEY,
client_name VARCHAR,
genesis_block VARCHAR(66),

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE log_filters
(
CREATE TABLE log_filters (
id SERIAL,
name VARCHAR NOT NULL CHECK (name <> ''),
from_block BIGINT CHECK (from_block >= 0),

View File

@ -1,25 +1,19 @@
-- +goose Up
ALTER TABLE public.nodes
RENAME TO eth_nodes;
ALTER TABLE public.nodes RENAME TO eth_nodes;
ALTER TABLE public.eth_nodes
RENAME COLUMN node_id TO eth_node_id;
ALTER TABLE public.eth_nodes RENAME COLUMN node_id TO eth_node_id;
ALTER TABLE public.eth_nodes
DROP CONSTRAINT node_uc;
ALTER TABLE public.eth_nodes DROP CONSTRAINT node_uc;
ALTER TABLE public.eth_nodes
ADD CONSTRAINT eth_node_uc UNIQUE (genesis_block, network_id, eth_node_id);
ALTER TABLE public.blocks
RENAME COLUMN node_id TO eth_node_id;
ALTER TABLE public.blocks RENAME COLUMN node_id TO eth_node_id;
ALTER TABLE public.blocks
DROP CONSTRAINT node_id_block_number_uc;
ALTER TABLE public.blocks DROP CONSTRAINT node_id_block_number_uc;
ALTER TABLE public.blocks
ADD CONSTRAINT eth_node_id_block_number_uc UNIQUE (number, eth_node_id);
ALTER TABLE public.blocks
DROP CONSTRAINT node_fk;
ALTER TABLE public.blocks DROP CONSTRAINT node_fk;
ALTER TABLE public.blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (eth_node_id) REFERENCES eth_nodes (id) ON DELETE CASCADE;
@ -37,16 +31,13 @@ ALTER TABLE public.nodes
ALTER TABLE public.nodes
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id);
ALTER TABLE public.blocks
RENAME COLUMN eth_node_id TO node_id;
ALTER TABLE public.blocks RENAME COLUMN eth_node_id TO node_id;
ALTER TABLE public.blocks
DROP CONSTRAINT eth_node_id_block_number_uc;
ALTER TABLE public.blocks DROP CONSTRAINT eth_node_id_block_number_uc;
ALTER TABLE public.blocks
ADD CONSTRAINT node_id_block_number_uc UNIQUE (number, node_id);
ALTER TABLE public.blocks
DROP CONSTRAINT node_fk;
ALTER TABLE public.blocks DROP CONSTRAINT node_fk;
ALTER TABLE public.blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (node_id) REFERENCES nodes (id) ON DELETE CASCADE;

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE public.headers
(
CREATE TABLE public.headers (
id SERIAL PRIMARY KEY,
hash VARCHAR(66),
block_number BIGINT,

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE public.queued_storage
(
CREATE TABLE public.queued_storage (
id SERIAL PRIMARY KEY,
block_height BIGINT,
block_hash BYTEA,

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE header_sync_transactions
(
CREATE TABLE header_sync_transactions (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES headers(id) ON DELETE CASCADE,
hash VARCHAR(66),

View File

@ -1,6 +1,5 @@
-- +goose Up
CREATE TABLE public.uncles
(
CREATE TABLE public.uncles (
id SERIAL PRIMARY KEY,
hash VARCHAR(66) NOT NULL,
block_id INTEGER NOT NULL REFERENCES blocks (id) ON DELETE CASCADE,