only migrate if user exists

This commit is contained in:
j 2016-01-07 15:53:41 +05:30
parent d3aab286f8
commit 529a01269d
1 changed files with 10 additions and 9 deletions

View File

@ -248,6 +248,7 @@ def upgrade_db(old, new=None):
if old <= '20160106-497-c86ba8a':
with db.session() as session:
u = User.get(settings.USER_ID)
if u:
l = u.library
for i in u.items.all():
if not i in l.items: