diff --git a/hive/indexer/posts.py b/hive/indexer/posts.py index ad545658bf6ec482f3f88110c35bb486a15750cf..4955eb9fbc0ad649dfc667998a5d392be48a739f 100644 --- a/hive/indexer/posts.py +++ b/hive/indexer/posts.py @@ -311,9 +311,12 @@ class Posts: sql = """ UPDATE hive_posts - SET - children = (SELECT children FROM hive_posts WHERE id = :id) :op 1 - WHERE id = :id""" + SET """ + if op == '+': + sql += """children = (SELECT children FROM hive_posts WHERE id = :id) + 1""" + else: + sql += """children = (SELECT children FROM hive_posts WHERE id = :id) - 1""" + sql += """ WHERE id = :id""" DB.query(sql, id=parent_id, op=op) @classmethod