Add clear function for the accounts table.
This commit is contained in:
parent
74434f370c
commit
08a5cfa80b
|
@ -209,6 +209,17 @@ pub fn init_accounts_table<P: consensus::Parameters>(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn clear_accounts_table<P: consensus::Parameters>(
|
||||
wdb: &WalletDb<P>,
|
||||
) -> Result<(), SqliteClientError> {
|
||||
wdb.conn.execute("PRAGMA foreign_keys = OFF;", NO_PARAMS)?;
|
||||
wdb.conn.execute( "DELETE FROM accounts;", NO_PARAMS, )?;
|
||||
wdb.conn.execute("PRAGMA foreign_keys = ON;", NO_PARAMS)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
/// Initialises the data database with the given block.
|
||||
///
|
||||
/// This enables a newly-created database to be immediately-usable, without needing to
|
||||
|
|
Loading…
Reference in New Issue