go-ethereum/shyftDb/postgres_setup/create_tables.psql
2018-05-16 15:23:08 -04:00

43 lines
No EOL
777 B
Text

CREATE TABLE IF NOT EXISTS blocks (
hash text primary key,
coinbase text,
gasUsed numeric,
gasLimit numeric,
txCount numeric,
uncleCount numeric,
age timestamp,
parentHash text,
uncleHash text,
difficulty bigint,
size text,
nonce numeric,
number bigint
);
CREATE TABLE IF NOT EXISTS txs (
txHash text,
to_addr text,
from_addr text,
blockhash text references blocks(hash),
blocknumber text,
amount numeric,
gasprice numeric,
gas numeric,
gasLimit numeric,
txFee numeric,
nonce numeric,
txStatus text,
isContract bool,
age timestamp,
data bytea
);
CREATE TABLE IF NOT EXISTS accounts (
addr text primary key unique,
balance numeric,
txCountAccount numeric
);
CREATE TABLE IF NOT EXISTS contracts (
txHash text
);