20 #ifndef RIPPLE_APP_DATA_DBINIT_H_INCLUDED
21 #define RIPPLE_APP_DATA_DBINIT_H_INCLUDED
46 {
"PRAGMA journal_size_limit=1582080;"}};
49 {
"BEGIN TRANSACTION;",
51 "CREATE TABLE IF NOT EXISTS Ledgers ( \
52 LedgerHash CHARACTER(64) PRIMARY KEY, \
53 LedgerSeq BIGINT UNSIGNED, \
54 PrevHash CHARACTER(64), \
55 TotalCoins BIGINT UNSIGNED, \
56 ClosingTime BIGINT UNSIGNED, \
57 PrevClosingTime BIGINT UNSIGNED, \
58 CloseTimeRes BIGINT UNSIGNED, \
59 CloseFlags BIGINT UNSIGNED, \
60 AccountSetHash CHARACTER(64), \
61 TransSetHash CHARACTER(64) \
63 "CREATE INDEX IF NOT EXISTS SeqLedger ON Ledgers(LedgerSeq);",
66 "DROP TABLE IF EXISTS Validations;",
73 inline constexpr
auto TxDBName{
"transaction.db"};
79 "PRAGMA page_size=4096;",
"PRAGMA journal_size_limit=1582080;",
80 "PRAGMA max_page_count=2147483646;",
82 #if (ULONG_MAX > UINT_MAX) && !defined(NO_SQLITE_MMAP)
83 "PRAGMA mmap_size=17179869184;"
90 "PRAGMA sqlite_noop_statement;"
95 {
"BEGIN TRANSACTION;",
97 "CREATE TABLE IF NOT EXISTS Transactions ( \
98 TransID CHARACTER(64) PRIMARY KEY, \
99 TransType CHARACTER(24), \
100 FromAcct CHARACTER(35), \
101 FromSeq BIGINT UNSIGNED, \
102 LedgerSeq BIGINT UNSIGNED, \
103 Status CHARACTER(1), \
107 "CREATE INDEX IF NOT EXISTS TxLgrIndex ON \
108 Transactions(LedgerSeq);",
110 "CREATE TABLE IF NOT EXISTS AccountTransactions ( \
111 TransID CHARACTER(64), \
112 Account CHARACTER(64), \
113 LedgerSeq BIGINT UNSIGNED, \
116 "CREATE INDEX IF NOT EXISTS AcctTxIDIndex ON \
117 AccountTransactions(TransID);",
118 "CREATE INDEX IF NOT EXISTS AcctTxIndex ON \
119 AccountTransactions(Account, LedgerSeq, TxnSeq, TransID);",
120 "CREATE INDEX IF NOT EXISTS AcctLgrIndex ON \
121 AccountTransactions(LedgerSeq, Account, TransID);",
123 "END TRANSACTION;"}};
134 "PRAGMA page_size=4096;",
"PRAGMA journal_size_limit=1582080;",
135 "PRAGMA max_page_count=2147483646;",
137 #if (ULONG_MAX > UINT_MAX) && !defined(NO_SQLITE_MMAP)
138 "PRAGMA mmap_size=17179869184;"
145 "PRAGMA sqlite_noop_statement;"
150 {
"BEGIN TRANSACTION;",
152 "CREATE TABLE IF NOT EXISTS LedgerMeta ( \
153 LedgerHash CHARACTER(64) PRIMARY KEY, \
157 "END TRANSACTION;"}};
168 "PRAGMA page_size=4096;",
"PRAGMA journal_size_limit=1582080;",
169 "PRAGMA max_page_count=2147483646;",
171 #if (ULONG_MAX > UINT_MAX) && !defined(NO_SQLITE_MMAP)
172 "PRAGMA mmap_size=17179869184;"
179 "PRAGMA sqlite_noop_statement;"
184 {
"BEGIN TRANSACTION;",
186 "CREATE TABLE IF NOT EXISTS TransactionMeta ( \
187 TransID CHARACTER(64) PRIMARY KEY, \
191 "END TRANSACTION;"}};
199 {
"PRAGMA journal_size_limit=1582080;"}};
202 {
"CREATE TABLE IF NOT EXISTS Shard ( \
203 ShardIndex INTEGER PRIMARY KEY, \
204 LastLedgerHash CHARACTER(64), \
205 StoredLedgerSeqs BLOB \
213 {
"PRAGMA synchronous=OFF;",
"PRAGMA journal_mode=OFF;"}};
220 {
"BEGIN TRANSACTION;",
228 "CREATE TABLE IF NOT EXISTS NodeIdentity ( \
229 PublicKey CHARACTER(53), \
230 PrivateKey CHARACTER(52) \
234 "CREATE TABLE IF NOT EXISTS PeerReservations ( \
235 PublicKey CHARACTER(53) UNIQUE NOT NULL, \
236 Description CHARACTER(64) NOT NULL \
240 "CREATE TABLE IF NOT EXISTS ValidatorManifests ( \
241 RawData BLOB NOT NULL \
244 "CREATE TABLE IF NOT EXISTS PublisherManifests ( \
245 RawData BLOB NOT NULL \
248 "END TRANSACTION;"}};
256 {
"PRAGMA synchronous=FULL;",
"PRAGMA journal_mode=DELETE;"}};
259 {
"BEGIN TRANSACTION;",
261 "CREATE TABLE IF NOT EXISTS State ( \
262 ShardIndex INTEGER PRIMARY KEY, \
266 "END TRANSACTION;"}};
269 {
"BEGIN TRANSACTION;",
271 "CREATE TABLE IF NOT EXISTS download ( \
274 Size BIGINT UNSIGNED, \
275 Part BIGINT UNSIGNED PRIMARY KEY \
278 "END TRANSACTION;"}};
constexpr std::array< char const *, 1 > AcquireShardDBPragma
constexpr auto AcquireShardDBName
constexpr auto WalletDBName
constexpr std::array< char const *, 4 > TxDBPragma
constexpr std::array< char const *, 3 > LgrMetaDBInit
constexpr std::array< char const *, 1 > AcquireShardDBInit
static constexpr std::array< char const *, 3 > ShardArchiveHandlerDBInit
constexpr std::array< char const *, 5 > LgrDBInit
constexpr auto LgrMetaDBName
static constexpr std::array< char const *, 2 > DownloaderDBPragma
constexpr auto TxMetaDBName
constexpr std::array< char const *, 1 > LgrDBPragma
constexpr std::array< char const *, 3 > TxMetaDBInit
constexpr std::array< char const *, 4 > LgrMetaDBPragma
constexpr std::uint32_t SQLITE_TUNING_CUTOFF
constexpr char const * CommonDBPragmaTemp
constexpr char const * CommonDBPragmaJournal
constexpr std::array< char const *, 4 > TxMetaDBPragma
constexpr std::array< char const *, 2 > FinalShardDBPragma
static constexpr auto stateDBName
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static constexpr std::array< char const *, 3 > DatabaseBodyDBInit
constexpr char const * CommonDBPragmaSync
constexpr std::array< char const *, 8 > TxDBInit
constexpr std::array< char const *, 6 > WalletDBInit