catch invalid card ordinals in DB check
https://forums.ankiweb.net/t/error-corrupted-note/10976
This commit is contained in:
parent
8942677c4b
commit
e3c9808b79
5
rslib/src/storage/card/fix_ordinal.sql
Normal file
5
rslib/src/storage/card/fix_ordinal.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
UPDATE cards
|
||||||
|
SET ord = max(0, min(30000, ord)),
|
||||||
|
mod = ?1,
|
||||||
|
usn = ?2
|
||||||
|
WHERE ord != max(0, min(30000, ord))
|
@ -286,6 +286,10 @@ impl super::SqliteStorage {
|
|||||||
.db
|
.db
|
||||||
.prepare(include_str!("fix_ivl.sql"))?
|
.prepare(include_str!("fix_ivl.sql"))?
|
||||||
.execute(params![mtime, usn])?;
|
.execute(params![mtime, usn])?;
|
||||||
|
other_cnt += self
|
||||||
|
.db
|
||||||
|
.prepare(include_str!("fix_ordinal.sql"))?
|
||||||
|
.execute(params![mtime, usn])?;
|
||||||
Ok((new_cnt, other_cnt))
|
Ok((new_cnt, other_cnt))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user