from patch.include import *


@app_context(commit=True)
def patch():
    notifies = models.CmfNotify.list(fields=['comments'], include_deleted=True)
    for notify in notifies:
        if not notify.comments:
            continue
        for comment in notify.comments:
            if not comment.get('id'):
                comment['id'] = 'CmfComment:00000000-0000-0000-0000-000000000000'
        notify.save(only_data=True)


if __name__ == "__main__":
    patch()
