another fix for new installs
This commit is contained in:
parent
58f516ff46
commit
9145ef5df6
1 changed files with 28 additions and 26 deletions
|
@ -487,6 +487,7 @@ def update_database():
|
||||||
item.models.update_sort_table()
|
item.models.update_sort_table()
|
||||||
|
|
||||||
def add_listitem_index():
|
def add_listitem_index():
|
||||||
|
if db.table_exists('listitem'):
|
||||||
with db.session() as session:
|
with db.session() as session:
|
||||||
sql = "SELECT COUNT(*) AS c,list_id,item_id FROM listitem GROUP BY list_id, item_id HAVING c>1"
|
sql = "SELECT COUNT(*) AS c,list_id,item_id FROM listitem GROUP BY list_id, item_id HAVING c>1"
|
||||||
doubles = [r for r in session.execute(sql)]
|
doubles = [r for r in session.execute(sql)]
|
||||||
|
@ -502,6 +503,7 @@ def add_listitem_index():
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
def add_useritem_index():
|
def add_useritem_index():
|
||||||
|
if db.table_exists('useritem'):
|
||||||
with db.session() as session:
|
with db.session() as session:
|
||||||
sql = "SELECT COUNT(*) AS c,user_id,item_id FROM useritem GROUP BY user_id, item_id HAVING c>1"
|
sql = "SELECT COUNT(*) AS c,user_id,item_id FROM useritem GROUP BY user_id, item_id HAVING c>1"
|
||||||
doubles = [r for r in session.execute(sql)]
|
doubles = [r for r in session.execute(sql)]
|
||||||
|
|
Loading…
Reference in a new issue