]> Untitled Git - bdk/commit
refactor(chain)!: move schemas to their own methods
authornymius <155548262+nymius@users.noreply.github.com>
Mon, 2 Dec 2024 15:26:55 +0000 (12:26 -0300)
committernymius <155548262+nymius@users.noreply.github.com>
Wed, 4 Dec 2024 17:14:25 +0000 (14:14 -0300)
commit2eb19f5073abd7d5e9c9b4183aa5efac6e76aca9
tree3668207963a5c51f0804970385bcc4fb286e311c
parent5603e9f6d1d3ff130317d6fd16332bf8b049b409
refactor(chain)!: move schemas to their own methods

We would like to test backward compatibility of new schemas.
To do so, we should be able to apply schemas independently.

Why to change `rusqlite::execute` by `rusqlite::execute_batch`?
- we are going to need to return the statements of the schemas as
  Strings, because we are now returning them from methods, it seemed
  redundant to keep getting references to something is already
  referencing data, i.e., keep moving around &String instead of String
  (consider `rusqlite::execute_batch` takes multiple statements as a
  single String)
- we were calling `rusqlite::execute` with empty params, so we weren't
  trapped by the method's signature
- `rustqlite::execute_batch` does the same than we were doing applying
  statements secuentially in a loop
- the code doesn't lose error expresivity: `rusqlite::execute_batch` is
  going to fail with the same errors `rusqlite::execute` does

BREAKING CHANGE: changes public method `migrate_schema` signature.
crates/chain/src/rusqlite_impl.rs
crates/wallet/src/wallet/changeset.rs