"""fix_models

Revision ID: 0fd327874a4a
Revises: 78199b833230
Create Date: 2023-04-24 18:10:45.276860

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0fd327874a4a'
down_revision = '78199b833230'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("update cmf_auth_open_id_plugin set domain = 'example.com' where domain is null")
    op.alter_column('cmf_auth_open_id_plugin', 'domain',
               existing_type=sa.VARCHAR(length=4096),
               nullable=False)
    op.add_column('cmf_comment', sa.Column('html_context', sa.TEXT(), nullable=True))
    op.add_column('cmf_plugin', sa.Column('ext_token_addon', sa.String(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('cmf_plugin', 'ext_token_addon')
    op.drop_column('cmf_comment', 'html_context')
    op.alter_column('cmf_auth_open_id_plugin', 'domain',
               existing_type=sa.VARCHAR(length=4096),
               nullable=True)
    # ### end Alembic commands ###
