empty lists are None not '', fixes #102

This commit is contained in:
j 2016-01-16 11:17:55 +05:30
commit d876768771
3 changed files with 14 additions and 3 deletions

View file

@ -18,6 +18,7 @@ import ox
from oxtornado import actions
import settings
import db
import logging
@ -277,7 +278,8 @@ class Update(Thread):
db_version = settings.server.get('db_version', 0)
if db_version < settings.DB_VERSION:
self.status('Migrating database...')
time.sleep(30)
if db_version < 1:
db_version = migrate_1()
settings.server['db_version'] = settings.DB_VERSION
def run(self):
@ -288,3 +290,12 @@ class Update(Thread):
return
self.status('Relaunching...', True)
restart_oml()
def migrate_1():
with db.session() as session:
import item.models
for s in item.models.Sort.query.filter_by(author=''):
s.item.update_sort()
session.commit()
return 1