mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix ordinal problems rather than aborting upgrade
This commit is contained in:
parent
92ee7597a9
commit
be8bec5bc4
1 changed files with 6 additions and 6 deletions
|
@ -81,12 +81,6 @@ select id from cards where cardModelId not in (select cm.id from
|
|||
cardModels cm, facts f where cm.modelId = f.modelId and
|
||||
f.id = cards.factId)"""):
|
||||
return
|
||||
# cards with the wrong ordinal?
|
||||
if db.list("""
|
||||
select c.id from cards c, cardModels cm
|
||||
where c.cardModelId = cm.id
|
||||
and c.ordinal != cm.ordinal"""):
|
||||
return
|
||||
# facts missing a card?
|
||||
if db.list("""
|
||||
select facts.id from facts
|
||||
|
@ -137,6 +131,12 @@ and c.ordinal != cm.ordinal"""):
|
|||
db.execute("pragma page_size = 4096")
|
||||
db.execute("pragma legacy_file_format = 0")
|
||||
|
||||
# previous versions sometimes had cards with incorrect ordinals and
|
||||
# the db check didn't fix that. so we fix it here:
|
||||
db.execute("""
|
||||
update cards set ordinal = (select ordinal from cardModels
|
||||
where id = cards.cardModelId)""")
|
||||
|
||||
# notes
|
||||
###########
|
||||
# tags should have a leading and trailing space if not empty, and not
|
||||
|
|
Loading…
Reference in a new issue