-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WalletRead::get_seed_account
#1259
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1259 +/- ##
==========================================
- Coverage 63.32% 63.22% -0.11%
==========================================
Files 121 121
Lines 13496 13519 +23
==========================================
+ Hits 8546 8547 +1
- Misses 4950 4972 +22 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1271f98
1271f98
to
79f5bb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 79f5bb4
@@ -69,6 +69,7 @@ impl<P: consensus::Parameters> RusqliteMigration for Migration<P> { | |||
(account_type = {account_type_imported} AND hd_seed_fingerprint IS NULL AND hd_account_index IS NULL) | |||
) | |||
); | |||
CREATE UNIQUE INDEX hd_account ON accounts_new (hd_seed_fingerprint, hd_account_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the full subtleties of UNIQUE INDEX
vs CONSTRAIN UNIQUE
and why you'd choose one over the other. AFAICT:
- They both produce an index.
UNIQUE INDEX
can be removed and added without altering the table (and I guessCREATE UNIQUE INDEX
fails if the table contains non-unique data?)UNIQUE INDEX
can include expressionsCONSTRAIN UNIQUE
has greater support inON CONFLICT
logic (whereasUNIQUE INDEX
only supportsINSERT ... ON CONFLICT
I think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was looking at this today. I think that the ON CONFLICT
capabilities are actually the same, from what I was reading, at least for recent releases? Given that the separate indices can be dropped and added independently, I think I have a slight preference for them, but I don't think it makes much difference one way or the other.
let expected_indices = vec![ | ||
r#"CREATE UNIQUE INDEX accounts_ufvk ON "accounts" (ufvk)"#, | ||
r#"CREATE UNIQUE INDEX accounts_uivk ON "accounts" (uivk)"#, | ||
r#"CREATE UNIQUE INDEX hd_account ON "accounts" (hd_seed_fingerprint, hd_account_index)"#, | ||
r#"CREATE INDEX "addresses_accounts" ON "addresses" ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this; I was unaware that uniqueness constraints were starting to be embedded in the indices (which prior to now I only thought were present for performance). I rely heavily on changes to init.rs
to track changes to the database structure and determine what constraints are applied.
Builds atop #1258