migrate listorder too

This commit is contained in:
j 2016-02-13 16:14:19 +05:30
parent 209ebeaab8
commit 01a3d9d38f

View file

@ -527,9 +527,13 @@ def migrate_11():
last = Changelog.query.filter_by(user_id=u.id).order_by('-revision').first() last = Changelog.query.filter_by(user_id=u.id).order_by('-revision').first()
if last: if last:
peer.info['revision'] = last.revision peer.info['revision'] = last.revision
for l in List.query.filter_by(user_id=u.id): listorder = []
for l in List.query.filter_by(user_id=u.id).order_by('index_'):
if l.name: if l.name:
peer.info['lists'][l.name] = [i.id for i in l.get_items()] peer.info['lists'][l.name] = [i.id for i in l.get_items()]
listorder.append(l.name)
if 'listorder' not in peer.info:
peer.info['listorder'] = listorder
for m in Metadata.query.filter_by(user_id=u.id): for m in Metadata.query.filter_by(user_id=u.id):
peer.library[m.item_id] = { peer.library[m.item_id] = {
'meta': dict(m.data), 'meta': dict(m.data),