"""Cache comments login

Revision ID: 0bcd3076aa54
Revises: 5df3c7a5f2a9
Create Date: 2020-11-03 15:51:04.448051

"""
from alembic import op
import sqlalchemy as sa
import sys
from pathlib import Path
sys.path.append(str(Path(".").resolve()))
from cmf.manage import *

# revision identifiers, used by Alembic.
revision = '0bcd3076aa54'
down_revision = '5df3c7a5f2a9'
branch_labels = None
depends_on = None


def upgrade():
    with APP.test_request_context('/'):
        return
        # for comment in models.CmfComment.list(filter=[['cmf_author_id', '!=', None], ['parent_id', '!=', None]],
        #                                       fileds=['cmf_author__login']):
        #     comment.cache_cmf_author_login = comment.cmf_author.login
        #     comment.cache_cmf_author_name = comment.cmf_author.name
        #     comment.cache_cmf_author_code = comment.cmf_author.code
        #     comment.save(only_data=True)


def downgrade():
    pass
