save changes

This commit is contained in:
j 2016-01-08 16:23:14 +05:30
parent d4a961f470
commit 11a20a5063
1 changed files with 3 additions and 1 deletions

View File

@ -296,7 +296,7 @@ def upgrade_db(old, new=None):
sql = 'CREATE UNIQUE INDEX IF NOT EXISTS useritem_index on useritem(user_id,item_id)'
session.execute(sql)
session.commit()
if old <= '20160108-551-7c23bfb':
if old <= '20160108-555-d4a961f' and new and new < "20160108-565-d4a961f":
with db.session() as session:
import item.models
from meta.utils import decode_html_data
@ -312,10 +312,12 @@ def upgrade_db(old, new=None):
if meta != i.meta:
#print(i, i.meta, meta)
i.meta = meta
changed = True
info = decode_html_data(i.info.copy())
if info != i.info:
#print(i, i.info, info)
i.info = info
changed = True
if changed:
i.save()