diff --git a/rslib/src/storage/card/fix_ordinal.sql b/rslib/src/storage/card/fix_ordinal.sql new file mode 100644 index 000000000..ebda0e447 --- /dev/null +++ b/rslib/src/storage/card/fix_ordinal.sql @@ -0,0 +1,5 @@ +UPDATE cards +SET ord = max(0, min(30000, ord)), + mod = ?1, + usn = ?2 +WHERE ord != max(0, min(30000, ord)) \ No newline at end of file diff --git a/rslib/src/storage/card/mod.rs b/rslib/src/storage/card/mod.rs index 80d53ee92..8e1c77070 100644 --- a/rslib/src/storage/card/mod.rs +++ b/rslib/src/storage/card/mod.rs @@ -286,6 +286,10 @@ impl super::SqliteStorage { .db .prepare(include_str!("fix_ivl.sql"))? .execute(params![mtime, usn])?; + other_cnt += self + .db + .prepare(include_str!("fix_ordinal.sql"))? + .execute(params![mtime, usn])?; Ok((new_cnt, other_cnt)) }