Drop accounts table instead.

We need to recreate the table each time it is cleared to handle any migrations. This is mostly a stop-gap measure until the migrations and table creations are handled by the same code.
This commit is contained in:
Kevin Gorham 2021-04-30 23:06:28 -04:00
parent 08a5cfa80b
commit 5a5100395a
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
1 changed files with 2 additions and 4 deletions

View File

@ -209,12 +209,10 @@ pub fn init_accounts_table<P: consensus::Parameters>(
Ok(())
}
pub fn clear_accounts_table<P: consensus::Parameters>(
pub fn drop_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)?;
wdb.conn.execute( "DROP TABLE accounts;", NO_PARAMS, )?;
Ok(())
}