From d2ee2521bd796384e6b42b9779ca955566d6eb01 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 15 Nov 2008 20:12:14 +0900 Subject: [PATCH] if there's an error upgrading, try fix integrity and try again --- anki/deck.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/anki/deck.py b/anki/deck.py index 921b2b6b1..a733c5a6a 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -1619,7 +1619,11 @@ alter table decks add column newCount integer not null default 0""") if backup: DeckStorage.backup(deck.modified, path) deck._initVars() - deck = DeckStorage._upgradeDeck(deck, path) + try: + deck = DeckStorage._upgradeDeck(deck, path) + except: + deck.fixIntegrity() + deck = DeckStorage._upgradeDeck(deck, path) except OperationalError, e: if (str(e.orig).startswith("database table is locked") or str(e.orig).startswith("database is locked")):