github.com/status-im/status-go@v1.1.0/appdatabase/migrations/sql/1674232431_add_balance_history.up.sql (about)

     1  -- One entry per chain_id, address, currency, block
     2  -- bitset is used to select time interval granularity. The least significant bit has the coarsest granularity
     3  -- balance is a serialized big.Int
     4  CREATE TABLE IF NOT EXISTS balance_history (
     5      chain_id UNSIGNED BIGINT NOT NULL,
     6      address VARCHAR NOT NULL,
     7      currency VARCHAR NOT NULL,
     8      block BIGINT NOT NULL,
     9      timestamp INT NOT NULL,
    10      bitset INT NOT NULL,
    11      balance BLOB
    12  );
    13  
    14  CREATE UNIQUE INDEX IF NOT EXISTS balance_history_identify_entry ON balance_history (chain_id, address, currency, block);
    15  CREATE INDEX IF NOT EXISTS balance_history_filter_entries ON balance_history (chain_id, address, currency, block, timestamp, bitset);