remove unused per isbn metadata table and related apis

This commit is contained in:
j 2016-01-21 11:58:07 +05:30
commit 6f4672d296
6 changed files with 14 additions and 133 deletions

View file

@ -224,20 +224,13 @@ def upgrade_db(old, new=None):
if old <= '20160110-583-59a3709' and new > '20160110-583-59a3709':
with db.session() as session:
import ox
from item.models import Item, Find, Metadata
from item.models import Item, Find
from meta.utils import decode_html_data
def cleanup_description(data):
if 'description' in data:
description = data['description']
description = description.replace('<br>', '\n').replace('</p><p>', '\n\n')
data['description'] = ox.strip_tags(description).strip()
for m in Metadata.query:
data = decode_html_data(m.data.copy())
cleanup_description(data)
if data != m.data:
#print(m, m.data, '\n',data, '\n\n')
m.data = data
m.save()
for i in Item.query:
changed = False
meta = decode_html_data(i.meta.copy())
@ -387,10 +380,6 @@ def upgrade_db(old, new=None):
if 'id' in i.meta:
del i.meta['id']
i.save()
for m in item.models.Metadata.query:
if 'id' in m.data:
del m.data['id']
m.save()
if old <= '20160106-495-d1b9e96':
run_sql('CREATE INDEX ix_useritem_user ON useritem ("user_id")')
if old <= '20160106-497-c86ba8a':
@ -457,7 +446,6 @@ def update_database():
item.models.File,
item.models.Find,
item.models.Item,
item.models.Metadata,
item.models.Scrape,
item.models.Sort,
item.models.Transfer,