add back priorityDue index

This commit is contained in:
Damien Elmes 2009-05-09 04:17:53 +09:00
parent b653d4dba9
commit 6893d01458

View file

@ -49,7 +49,7 @@ REV_CARDS_RANDOM = 3
SEARCH_TAG = 0 SEARCH_TAG = 0
SEARCH_TYPE = 1 SEARCH_TYPE = 1
SEARCH_PHRASE = 2 SEARCH_PHRASE = 2
DECK_VERSION = 34 DECK_VERSION = 35
deckVarsTable = Table( deckVarsTable = Table(
'deckVars', metadata, 'deckVars', metadata,
@ -2655,9 +2655,13 @@ class DeckStorage(object):
def _addIndices(deck): def _addIndices(deck):
"Add indices to the DB." "Add indices to the DB."
# failed cards, review early, check due # failed cards, review early
deck.s.statement(""" deck.s.statement("""
create index if not exists ix_cards_duePriority on cards create index if not exists ix_cards_duePriority on cards
(type, isDue, combinedDue, priority)""")
# check due
deck.s.statement("""
create index if not exists ix_cards_priorityDue on cards
(type, isDue, combinedDue, priority)""") (type, isDue, combinedDue, priority)""")
# card spacing # card spacing
deck.s.statement(""" deck.s.statement("""
@ -3076,6 +3080,10 @@ nextFactor, reps, thinkingTime, yesCount, noCount from reviewHistory""")
deck.updateDynamicIndices() deck.updateDynamicIndices()
deck.version = 34 deck.version = 34
deck.s.commit() deck.s.commit()
if deck.version < 35:
DeckStorage._addIndices(deck)
deck.version = 35
deck.s.commit()
# executing a pragma here is very slow on large decks, so we store # executing a pragma here is very slow on large decks, so we store
# our own record # our own record
if not deck.getInt("pageSize") == 4096: if not deck.getInt("pageSize") == 4096: