Skip to content

Commit

Permalink
Add datatype for is_spent sqlite column
Browse files Browse the repository at this point in the history
Although, Sqlite column accepts
values of any type, it is
important to annotate this column
to make it easy to reason about.
  • Loading branch information
vladimirfomene committed Aug 28, 2022
1 parent 9f9ffd0 commit 0c9dabe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/database/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ static MIGRATIONS: &[&str] = &[
"DELETE FROM transactions;",
"DELETE FROM utxos;",
"DROP INDEX idx_txid_vout;",
"CREATE UNIQUE INDEX idx_utxos_txid_vout ON utxos(txid, vout);",
"ALTER TABLE utxos RENAME TO utxos_old;",
"CREATE TABLE utxos (value INTEGER, keychain TEXT, vout INTEGER, txid BLOB, script BLOB, is_spent BOOLEAN DEFAULT 0);",
"INSERT INTO utxos SELECT value, keychain, vout, txid, script, is_spent FROM utxos_old;",
"DROP TABLE utxos_old;",
"CREATE UNIQUE INDEX idx_utxos_txid_vout ON utxos(txid, vout);"
];

Expand Down

0 comments on commit 0c9dabe

Please sign in to comment.