Remove old Prefs type-checking code

This commit is contained in:
Zed 2019-10-29 18:48:17 +01:00
parent 25a6590a56
commit 68cf8216b7

View file

@ -4,17 +4,6 @@ import norm/sqlite
import prefs_impl, types import prefs_impl, types
export genUpdatePrefs export genUpdatePrefs
static:
var pFields: seq[string]
for id in getTypeImpl(Prefs)[2]:
if $id[0] == "id": continue
pFields.add $id[0]
let pDefs = toSeq(allPrefs()).mapIt(it.name)
let missing = pDefs.filterIt(it notin pFields)
if missing.len > 0:
raiseAssert("{$1} missing from the Prefs type" % missing.join(", "))
template safeAddColumn(field: typedesc): untyped = template safeAddColumn(field: typedesc): untyped =
try: field.addColumn try: field.addColumn
except DbError: discard except DbError: discard