mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
fix upgrade code for the lock hack
This commit is contained in:
parent
9226922af8
commit
945e5e9da8
2 changed files with 6 additions and 0 deletions
|
@ -119,6 +119,9 @@ qconf=?, conf=?, data=?""",
|
|||
self.lock()
|
||||
|
||||
def lock(self):
|
||||
# we don't know if pysqlite has taken out a transaction from under us,
|
||||
# so make sure we're committed
|
||||
self.db.commit()
|
||||
self.db.execute("begin exclusive")
|
||||
self.db.execute("update deck set mod=mod")
|
||||
|
||||
|
@ -814,5 +817,7 @@ seq > :s and seq <= :e order by seq desc""", s=start, e=end)
|
|||
return "\n".join(problems)
|
||||
|
||||
def optimize(self):
|
||||
self.db.commit()
|
||||
self.db.execute("vacuum")
|
||||
self.db.execute("analyze")
|
||||
self.lock()
|
||||
|
|
|
@ -505,6 +505,7 @@ between 0 and 1""", stamp=deck.sched.dayCutoff, today=deck.sched.today)
|
|||
|
||||
# optimize and finish
|
||||
deck.sched.updateDynamicIndices()
|
||||
deck.db.commit()
|
||||
deck.db.execute("vacuum")
|
||||
deck.db.execute("analyze")
|
||||
deck.db.execute("update deck set ver = ?", CURRENT_VERSION)
|
||||
|
|
Loading…
Reference in a new issue