rewrite replyto stage
This commit is contained in:
parent
b2552f43b0
commit
bd4221e9af
|
@ -84,16 +84,12 @@ def migrate(entry, shouts_by_oid):
|
||||||
raise e
|
raise e
|
||||||
return comment_dict
|
return comment_dict
|
||||||
|
|
||||||
def migrate_2stage(entry, id_map):
|
def migrate_2stage(cmt, old_new_id):
|
||||||
old_reply_to = entry.get('replyTo')
|
reply_oid = cmt.get('replyTo')
|
||||||
if not old_reply_to:
|
if not reply_oid: return
|
||||||
return
|
new_id = old_new_id.get(cmt['_id'])
|
||||||
old_id = entry['_id']
|
if not new_id: return
|
||||||
if not old_id in id_map:
|
|
||||||
return
|
|
||||||
id = id_map[old_id]
|
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
comment = session.query(Comment).filter(Comment.id == id).first()
|
comment = session.query(Comment).filter(Comment.id == new_id).first()
|
||||||
reply_to = id_map.get(old_reply_to)
|
comment.replyTo = old_new_id.get(reply_oid)
|
||||||
comment.replyTo = reply_to
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user