mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
deck upgrade
This commit is contained in:
parent
cabf25bacc
commit
b9cc9bf0b2
2 changed files with 12 additions and 4 deletions
|
@ -20,6 +20,7 @@ defaultDeck = {
|
||||||
'usn': 0,
|
'usn': 0,
|
||||||
'desc': "",
|
'desc': "",
|
||||||
'dyn': 0,
|
'dyn': 0,
|
||||||
|
'collapsed': False
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultDynamicDeck = {
|
defaultDynamicDeck = {
|
||||||
|
@ -27,6 +28,7 @@ defaultDynamicDeck = {
|
||||||
'revToday': [0, 0],
|
'revToday': [0, 0],
|
||||||
'lrnToday': [0, 0],
|
'lrnToday': [0, 0],
|
||||||
'timeToday': [0, 0],
|
'timeToday': [0, 0],
|
||||||
|
'collapsed': False,
|
||||||
'dyn': 1,
|
'dyn': 1,
|
||||||
'desc': "",
|
'desc': "",
|
||||||
'usn': 0,
|
'usn': 0,
|
||||||
|
|
|
@ -46,8 +46,9 @@ def Collection(path, lock=True, server=False, sync=True):
|
||||||
|
|
||||||
# no upgrades necessary at the moment
|
# no upgrades necessary at the moment
|
||||||
def _upgradeSchema(db):
|
def _upgradeSchema(db):
|
||||||
if db.scalar("select ver from col") == SCHEMA_VERSION:
|
ver = db.scalar("select ver from col")
|
||||||
return SCHEMA_VERSION
|
if ver == SCHEMA_VERSION:
|
||||||
|
return ver
|
||||||
# add odid to cards, edue->odue
|
# add odid to cards, edue->odue
|
||||||
######################################################################
|
######################################################################
|
||||||
if db.scalar("select ver from col") == 1:
|
if db.scalar("select ver from col") == 1:
|
||||||
|
@ -71,10 +72,15 @@ id, guid, mid, mod, usn, tags, flds, sfld, csum, flags, data from notes2""")
|
||||||
db.execute("drop table notes2")
|
db.execute("drop table notes2")
|
||||||
db.execute("update col set ver = 3")
|
db.execute("update col set ver = 3")
|
||||||
_updateIndices(db)
|
_updateIndices(db)
|
||||||
return SCHEMA_VERSION
|
return ver
|
||||||
|
|
||||||
def _upgrade(col, ver):
|
def _upgrade(col, ver):
|
||||||
return
|
if ver < 3:
|
||||||
|
# new deck properties
|
||||||
|
for d in col.decks.all():
|
||||||
|
d['dyn'] = 0
|
||||||
|
d['collapsed'] = False
|
||||||
|
col.decks.save(d)
|
||||||
|
|
||||||
# Creating a new collection
|
# Creating a new collection
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
Loading…
Reference in a new issue