"""1.0.6

Revision ID: 232dfa044617
Revises: e734c7fe6056
Create Date: 2023-09-19 21:34:41.994617

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '232dfa044617'
down_revision = 'e734c7fe6056'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # 搜索优先级
    op.execute("delete from systemconfig where key = 'SearchFilterRules';")
    op.execute(
        "insert into systemconfig(key, value) VALUES('SearchFilterRules', (select value from systemconfig where key= 'FilterRules'));")
    # 订阅优先级
    op.execute("delete from systemconfig where key = 'SubscribeFilterRules';")
    op.execute(
        "insert into systemconfig(key, value) VALUES('SubscribeFilterRules', (select value from systemconfig where key= 'FilterRules'));")
    # 洗版优先级
    op.execute("delete from systemconfig where key = 'BestVersionFilterRules';")
    op.execute(
        "insert into systemconfig(key, value) VALUES('BestVersionFilterRules', (select value from systemconfig where key= 'FilterRules2'));")
    # 删除旧的优先级规则
    op.execute("delete from systemconfig where key = 'FilterRules';")
    op.execute("delete from systemconfig where key = 'FilterRules2';")
    # ### end Alembic commands ###


def downgrade() -> None:
    pass
