2026-01-21 12:34:59 +01:00
|
|
|
// Copyright (C) 2024-2026 Whiterun LLC
|
2024-03-04 16:40:50 +01:00
|
|
|
//
|
|
|
|
|
// This software is licensed under the GNU Affero General Public License (AGPL), version 3.0 or later.
|
|
|
|
|
// A copy of the license can be found in the LICENSE file or at https://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
|
|
2026-02-17 17:47:43 +01:00
|
|
|
use sqlx::SqlitePool;
|
2024-03-14 12:14:13 +01:00
|
|
|
|
2024-05-09 11:25:27 +02:00
|
|
|
pub mod bcmr;
|
Convert hash columns from TEXT to BLOB storage
Migrate all 32-byte hash fields from TEXT (64-char hex) to BLOB
(32 bytes) for ~50% storage savings on hash columns.
Changes:
- Add src/db/blob.rs with ToBlob/FromBlob traits for hash types
- Update all table schemas to use BLOB for hash columns
- Replace .to_hex() with .to_blob() for DB inserts
- Replace ::from_hex() with ::from_blob() for DB reads
- Use SQL hex() function where API responses need hex strings
- Bump DB_VERSION from 4 to 5
Affected tables: tx, pool, pool_history_entry, utxo_spending,
utxo_funding, user_action, auth_chain_entry, bcmr_data,
bcmr_failure, bcmr_well_known, crc20, crc20_candidates,
delphi_entry, cached_token_metrics
Fixes #1
2026-01-21 13:25:35 +01:00
|
|
|
pub mod blob;
|
2024-05-09 11:25:27 +02:00
|
|
|
pub mod cauldron;
|
2024-10-21 12:48:47 +02:00
|
|
|
pub mod crc20;
|
2026-04-27 02:02:38 +03:00
|
|
|
pub mod ido;
|
2026-01-05 15:40:01 +01:00
|
|
|
pub mod init;
|
2026-03-17 17:40:01 +01:00
|
|
|
pub mod moria;
|
2025-05-20 16:17:32 +02:00
|
|
|
pub mod oracle;
|
2024-10-31 10:55:29 +00:00
|
|
|
pub mod search;
|
2024-03-04 16:40:50 +01:00
|
|
|
|
2024-05-09 11:25:27 +02:00
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub struct DB {
|
|
|
|
|
// readwrite
|
2026-02-17 17:47:43 +01:00
|
|
|
pub cauldron_w: SqlitePool,
|
2024-05-09 11:25:27 +02:00
|
|
|
// readonly
|
2026-02-17 17:47:43 +01:00
|
|
|
pub cauldron_r: SqlitePool,
|
2024-05-09 11:25:27 +02:00
|
|
|
// readonly
|
2026-02-17 17:47:43 +01:00
|
|
|
pub bcmr_r: SqlitePool,
|
|
|
|
|
// readwrite
|
|
|
|
|
pub bcmr_w: SqlitePool,
|
2024-05-09 11:25:27 +02:00
|
|
|
// readwrite
|
2026-02-17 17:47:43 +01:00
|
|
|
pub crc20_w: SqlitePool,
|
2024-10-21 12:48:47 +02:00
|
|
|
// readonly
|
|
|
|
|
#[allow(dead_code)]
|
2026-02-17 17:47:43 +01:00
|
|
|
pub crc20_r: SqlitePool,
|
2025-05-20 16:17:32 +02:00
|
|
|
// on-chain oracles
|
2026-02-17 17:47:43 +01:00
|
|
|
pub oracle_w: SqlitePool,
|
|
|
|
|
pub oracle_r: SqlitePool,
|
2026-03-17 17:40:01 +01:00
|
|
|
// moria lending protocol
|
|
|
|
|
pub moria_w: SqlitePool,
|
|
|
|
|
pub moria_r: SqlitePool,
|
2026-04-25 20:15:15 +03:00
|
|
|
// ido
|
|
|
|
|
pub ido_w: SqlitePool,
|
|
|
|
|
pub ido_r: SqlitePool,
|
2024-03-04 16:40:50 +01:00
|
|
|
}
|