From c270f39de94b52ca2e56fa1e946c187c56e4b792 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 13 Oct 2022 13:19:47 -0500 Subject: [PATCH] Update schema (#61) Updates table to add header_cids.uncles_hash --- pkg/types/schema.go | 4 ++-- pkg/types/table.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/types/schema.go b/pkg/types/schema.go index 42813b5..c3307c6 100644 --- a/pkg/types/schema.go +++ b/pkg/types/schema.go @@ -34,14 +34,14 @@ var TableHeader = Table{ {"state_root", varchar}, {"tx_root", varchar}, {"receipt_root", varchar}, - {"uncle_root", varchar}, + {"uncles_hash", varchar}, {"bloom", bytea}, {"timestamp", numeric}, {"mh_key", text}, {"times_validated", integer}, {"coinbase", varchar}, }, - "ON CONFLICT (block_hash, block_number) DO UPDATE SET (parent_hash, cid, td, node_id, reward, state_root, tx_root, receipt_root, uncle_root, bloom, timestamp, mh_key, times_validated, coinbase) = (EXCLUDED.parent_hash, EXCLUDED.cid, EXCLUDED.td, EXCLUDED.node_id, EXCLUDED.reward, EXCLUDED.state_root, EXCLUDED.tx_root, EXCLUDED.receipt_root, EXCLUDED.uncle_root, EXCLUDED.bloom, EXCLUDED.timestamp, EXCLUDED.mh_key, eth.header_cids.times_validated + 1, EXCLUDED.coinbase)", + "ON CONFLICT (block_hash, block_number) DO UPDATE SET (parent_hash, cid, td, node_id, reward, state_root, tx_root, receipt_root, uncles_hash, bloom, timestamp, mh_key, times_validated, coinbase) = (EXCLUDED.parent_hash, EXCLUDED.cid, EXCLUDED.td, EXCLUDED.node_id, EXCLUDED.reward, EXCLUDED.state_root, EXCLUDED.tx_root, EXCLUDED.receipt_root, EXCLUDED.uncles_hash, EXCLUDED.bloom, EXCLUDED.timestamp, EXCLUDED.mh_key, eth.header_cids.times_validated + 1, EXCLUDED.coinbase)", } var TableStateNode = Table{ diff --git a/pkg/types/table.go b/pkg/types/table.go index 36299b4..2a1f1e4 100644 --- a/pkg/types/table.go +++ b/pkg/types/table.go @@ -24,7 +24,7 @@ type column struct { type Table struct { Name string Columns []column - conflictClause string + ConflictClause string } func (tbl *Table) ToCsvRow(args ...interface{}) []string { @@ -43,7 +43,7 @@ func (tbl *Table) ToInsertStatement() string { } return fmt.Sprintf( "INSERT INTO %s (%s) VALUES (%s) %s", - tbl.Name, strings.Join(colnames, ", "), strings.Join(placeholders, ", "), tbl.conflictClause, + tbl.Name, strings.Join(colnames, ", "), strings.Join(placeholders, ", "), tbl.ConflictClause, ) }