Skip to content

Commit

Permalink
db schemas merged (0xPolygonHermez#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 authored Jun 14, 2022
1 parent 9dadd45 commit c546d46
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 51 deletions.
44 changes: 44 additions & 0 deletions db/migrations/0001.sql
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,47 @@ CREATE TABLE state.misc

-- Insert default values into misc table
INSERT INTO state.misc (last_batch_num_seen, last_batch_num_consolidated, init_sync_batch) VALUES(0, 0, 0);

CREATE SCHEMA pool

CREATE TABLE pool.txs (
hash VARCHAR PRIMARY KEY,
encoded VARCHAR,
decoded jsonb,
state varchar(15),
gas_price DECIMAL(78,0),
nonce DECIMAL(78,0),
is_claims BOOLEAN,
received_at TIMESTAMP WITH TIME ZONE NOT NULL
);

CREATE INDEX idx_state_gas_price_nonce ON pool.txs(state, gas_price, nonce);

CREATE TABLE pool.gas_price (
item_id SERIAL PRIMARY KEY,
price DECIMAL(78,0),
timestamp TIMESTAMP WITH TIME ZONE NOT NULL
);

-- Table that stores all MerkleTree nodes
CREATE TABLE state.merkletree
(
hash BYTEA PRIMARY KEY,
data BYTEA NOT NULL
);

-- Table that stores all smart contract code
CREATE TABLE state.sc_code
(
hash BYTEA PRIMARY KEY,
data BYTEA
);

CREATE SCHEMA rpc

CREATE TABLE rpc.filters (
id SERIAL PRIMARY KEY,
filter_type VARCHAR(15) NOT NULL,
parameters JSONB NOT NULL,
last_poll TIMESTAMP NOT NULL
);
22 changes: 0 additions & 22 deletions db/migrations/0002.sql

This file was deleted.

19 changes: 0 additions & 19 deletions db/migrations/0003.sql

This file was deleted.

10 changes: 0 additions & 10 deletions db/migrations/0004.sql

This file was deleted.

0 comments on commit c546d46

Please sign in to comment.