mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
add indices to upgrade check if missing
This commit is contained in:
parent
4668b1a210
commit
37ea359931
2 changed files with 9 additions and 0 deletions
|
@ -53,6 +53,11 @@ class Upgrader(object):
|
|||
# old version?
|
||||
if db.scalar("select version from decks") != 65:
|
||||
return
|
||||
# ensure we have indices for checks below
|
||||
db.executescript("""
|
||||
create index if not exists ix_cards_factId on cards (factId);
|
||||
create index if not exists ix_fields_factId on fieldModels (factId);
|
||||
analyze;""")
|
||||
# fields missing a field model?
|
||||
if db.list("""
|
||||
select id from fields where fieldModelId not in (
|
||||
|
|
|
@ -193,6 +193,10 @@ def maxID(db):
|
|||
def guid64():
|
||||
return random.randint(-sys.maxint-1, sys.maxint)
|
||||
|
||||
def guid32():
|
||||
max = 2**32
|
||||
return random.randint(0, max-1)
|
||||
|
||||
# Fields
|
||||
##############################################################################
|
||||
|
||||
|
|
Loading…
Reference in a new issue