Skip to content

Commit

Permalink
Add simple migration for theme preference
Browse files Browse the repository at this point in the history
  • Loading branch information
zedeus committed Oct 23, 2019
1 parent 4a5d999 commit 4f74619
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/prefs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ static:
if missing.len > 0:
raiseAssert("{$1} missing from the Prefs type" % missing.join(", "))

template safeAddColumn(field: typedesc): untyped =
try: field.addColumn
except DbError: discard

dbFromTypes("prefs.db", "", "", "", [Prefs])

withDb:
try:
createTables()
except DbError:
discard
Prefs.theme.safeAddColumn

proc getDefaultPrefs(hostname: string): Prefs =
result = genDefaultPrefs()
Expand Down

0 comments on commit 4f74619

Please sign in to comment.