mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
commit before pragmas
This commit is contained in:
parent
11cd9af5ca
commit
dfd70ce4a1
1 changed files with 3 additions and 0 deletions
|
@ -2006,6 +2006,7 @@ select id from fields where factId not in (select id from facts)""")
|
|||
|
||||
def optimize(self):
|
||||
oldSize = os.stat(self.path)[stat.ST_SIZE]
|
||||
self.s.commit()
|
||||
self.s.statement("vacuum")
|
||||
self.s.statement("analyze")
|
||||
newSize = os.stat(self.path)[stat.ST_SIZE]
|
||||
|
@ -2283,6 +2284,7 @@ class DeckStorage(object):
|
|||
initTagTables(deck.s)
|
||||
if create:
|
||||
# new-style file format
|
||||
deck.s.commit()
|
||||
deck.s.execute("pragma legacy_file_format = off")
|
||||
deck.s.execute("pragma default_cache_size= 20000")
|
||||
deck.s.execute("vacuum")
|
||||
|
@ -2496,6 +2498,7 @@ order by priority desc, due desc""")
|
|||
except:
|
||||
print "failed to upgrade"
|
||||
# rebuild with new file format
|
||||
deck.s.commit()
|
||||
deck.s.execute("pragma legacy_file_format = off")
|
||||
deck.s.execute("vacuum")
|
||||
# add views/indices
|
||||
|
|
Loading…
Reference in a new issue