From f8d846c19a8d5a9877bcf55cb03a3ccc40ac24c1 Mon Sep 17 00:00:00 2001 From: Louis <450793585@qq.com> Date: Thu, 21 Nov 2024 15:18:52 +0800 Subject: [PATCH] feat: Formatted database file (#3) --- migrations/00001_create_schema.sql | 42 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/migrations/00001_create_schema.sql b/migrations/00001_create_schema.sql index 1be7513..ffdeceb 100644 --- a/migrations/00001_create_schema.sql +++ b/migrations/00001_create_schema.sql @@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS tokens ( token_name VARCHAR NOT NULL, collect_amount UINT256 NOT NULL CHECK(collect_amount>0), timestamp INTEGER NOT NULL CHECK(timestamp>0) - ); +); CREATE INDEX IF NOT EXISTS tokens_timestamp ON tokens(timestamp); CREATE INDEX IF NOT EXISTS tokens_token_address ON tokens(token_address); @@ -49,13 +49,13 @@ CREATE INDEX IF NOT EXISTS addresses_timestamp ON addresses(timestamp); CREATE TABLE IF NOT EXISTS balances ( - guid VARCHAR PRIMARY KEY, - address VARCHAR NOT NULL, - address_type SMALLINT NOT NULL DEFAULT 0, - token_address VARCHAR NOT NULL, - balance UINT256 NOT NULL CHECK(balance>=0), - lock_balance UINT256 NOT NULL, - timestamp INTEGER NOT NULL CHECK(timestamp>0) + guid VARCHAR PRIMARY KEY, + address VARCHAR NOT NULL, + address_type SMALLINT NOT NULL DEFAULT 0, + token_address VARCHAR NOT NULL, + balance UINT256 NOT NULL CHECK(balance>=0), + lock_balance UINT256 NOT NULL, + timestamp INTEGER NOT NULL CHECK(timestamp>0) ); CREATE INDEX IF NOT EXISTS balances_address ON balances(address); CREATE INDEX IF NOT EXISTS balances_timestamp ON balances(timestamp); @@ -63,19 +63,19 @@ CREATE INDEX IF NOT EXISTS balances_timestamp ON balances(timestamp); CREATE TABLE IF NOT EXISTS transactions ( - guid VARCHAR PRIMARY KEY, - block_hash VARCHAR NOT NULL, - block_number UINT256 NOT NULL CHECK(block_number>0), - hash VARCHAR NOT NULL, - from_address VARCHAR NOT NULL, - to_address VARCHAR NOT NULL, - token_address VARCHAR NOT NULL, - fee UINT256 NOT NULL, - amount UINT256 NOT NULL, - status SMALLINT NOT NULL DEFAULT 0, - transaction_index UINT256 NOT NULL, - tx_type SMALLINT NOT NULL DEFAULT 0, - timestamp INTEGER NOT NULL CHECK(timestamp>0) + guid VARCHAR PRIMARY KEY, + block_hash VARCHAR NOT NULL, + block_number UINT256 NOT NULL CHECK(block_number>0), + hash VARCHAR NOT NULL, + from_address VARCHAR NOT NULL, + to_address VARCHAR NOT NULL, + token_address VARCHAR NOT NULL, + fee UINT256 NOT NULL, + amount UINT256 NOT NULL, + status SMALLINT NOT NULL DEFAULT 0, + transaction_index UINT256 NOT NULL, + tx_type SMALLINT NOT NULL DEFAULT 0, + timestamp INTEGER NOT NULL CHECK(timestamp>0) ); CREATE INDEX IF NOT EXISTS transactions_hash ON transactions(hash); CREATE INDEX IF NOT EXISTS transactions_timestamp ON transactions(timestamp);