Handle invalid float mtimes in DB check

Likely an add-on or third-party tool created them, and they were breaking
DB queries for a user.

https://sqlite.org/stricttables.html could help us avoid this class of
issue in the future, though we'd need to check what client versions we'd
break with this change, and would need to change the 'sfld is an integer'
hack.
This commit is contained in:
Damien Elmes 2023-06-26 13:40:40 +10:00
parent 8646d48d93
commit 684e46b2a7
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,3 @@
UPDATE cards
SET mod = cast(mod AS integer)
WHERE mod != cast(mod AS integer)

View file

@ -353,6 +353,10 @@ impl super::SqliteStorage {
.db
.prepare(include_str!("fix_ivl.sql"))?
.execute(params![mtime, usn])?;
other_cnt += self
.db
.prepare(include_str!("fix_mod.sql"))?
.execute(params![])?;
other_cnt += self
.db
.prepare(include_str!("fix_ordinal.sql"))?