diff --git a/anki/deck.py b/anki/deck.py index b51492977..725e28e6e 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -69,7 +69,7 @@ SEARCH_FIELD = 6 SEARCH_FIELD_EXISTS = 7 SEARCH_QA = 8 SEARCH_PHRASE_WB = 9 -DECK_VERSION = 55 +DECK_VERSION = 56 deckVarsTable = Table( 'deckVars', metadata, @@ -3750,6 +3750,11 @@ create index if not exists ix_cards_typeCombined on cards deck.s.statement(""" create index if not exists ix_cards_relativeDelay on cards (relativeDelay)""") + # priority - temporary index to make compat code faster. this can be + # removed when all clients are on 1.2, as can the ones below + deck.s.statement(""" +create index if not exists ix_cards_priority on cards +(priority)""") # failed cards, review early - obsolete deck.s.statement(""" create index if not exists ix_cards_duePriority on cards @@ -4295,6 +4300,11 @@ update fieldModels set quizFontFamily = 'Arial' where not quizFontFamily or quizFontFamily is null""") deck.version = 55 deck.s.commit() + if deck.version < 56: + # add an index for priority + DeckStorage._addIndices(deck) + deck.version = 56 + deck.s.commit() # executing a pragma here is very slow on large decks, so we store # our own record if not deck.getInt("pageSize") == 4096: