feat(db): update indexes and add nbtc_withdrawal#55
Merged
robert-zaremba merged 4 commits intomasterfrom Aug 8, 2025
Merged
Conversation
Signed-off-by: Robert Zaremba <robert@zaremba.ch>
Contributor
Reviewer's GuideThis PR refactors existing database indexes by removing redundant single-column indexes and introducing timestamp-inclusive composite indexes, and introduces a new nbtc_withdrawal table to track nBTC withdrawal transactions. Entity relationship diagram for updated nBTC tableserDiagram
nbtc_txs {
TEXT tx_id PK
TEXT sui_recipient
INTEGER status
INTEGER created_at
INTEGER updated_at
}
nbtc_withdrawal {
TEXT sui_tx_id PK
TEXT sender
INTEGER amount
TEXT recipient
TEXT note
INTEGER sent_at
TEXT btc_tx_id
INTEGER status
}
processed_blocks {
INTEGER height PK
INTEGER processed_at
}
%% Relationships (if any) are not explicit in schema, so not shown
Class diagram for new nbtc_withdrawal tableclassDiagram
class nbtc_withdrawal {
+TEXT sui_tx_id
+TEXT sender
+INTEGER amount
+TEXT recipient
+TEXT note
+INTEGER sent_at
+TEXT btc_tx_id
+INTEGER status
}
Class diagram for updated nbtc_txs indexesclassDiagram
class nbtc_txs {
+TEXT tx_id
+TEXT sui_recipient
+INTEGER status
+INTEGER created_at
+INTEGER updated_at
<<INDEX>> status
<<INDEX>> sui_recipient, created_at
}
Class diagram for updated processed_blocks indexesclassDiagram
class processed_blocks {
+INTEGER height
+INTEGER processed_at
<<INDEX REMOVED>> height
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors database indexes and adds support for nBTC withdrawals. The changes optimize index structure by adding timestamp-based sorting and remove unnecessary indexes.
- Optimizes existing indexes by adding timestamp columns for better query performance
- Adds a new
nbtc_withdrawaltable to track withdrawal transactions from SUI to Bitcoin - Removes two redundant indexes on processed blocks and updates the recipient index structure
Contributor
There was a problem hiding this comment.
Hey @robert-zaremba - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary by Sourcery
Refine the BTC indexer schema by cleaning up obsolete indexes, enhancing existing indexes with timestamps, and introducing the nbtc_withdrawal table to support withdrawal tracking.
New Features:
Enhancements: