"""dialogs add parameters

Revision ID: 019bbe8d4833
Revises: 37606c5a9b9e
Create Date: 2025-01-15 11:26:21.253007

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = '019bbe8d4833'
down_revision: Union[str, None] = '37606c5a9b9e'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user_tenant')
    op.drop_table('knowledgebase')
    op.drop_table('apps')
    op.drop_table('dialog')
    op.drop_table('flow')
    op.add_column('dialogs', sa.Column('parameters', sa.Text(), nullable=True))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('dialogs', 'parameters')
    op.create_table('flow',
    sa.Column('id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('status', mysql.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('description', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('user_id', mysql.INTEGER(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_table('dialog',
    sa.Column('id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('status', mysql.VARCHAR(length=1), nullable=False),
    sa.Column('description', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('tenant_id', mysql.VARCHAR(length=36), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_table('apps',
    sa.Column('id', mysql.VARCHAR(length=36), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('status', mysql.VARCHAR(length=16), nullable=False),
    sa.Column('description', mysql.TEXT(), nullable=False),
    sa.Column('tenant_id', mysql.VARCHAR(length=36), nullable=False),
    sa.Column('mode', mysql.VARCHAR(length=36), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_table('knowledgebase',
    sa.Column('id', mysql.VARCHAR(length=36), nullable=False),
    sa.Column('name', mysql.VARCHAR(length=128), nullable=True),
    sa.Column('permission', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('tenant_id', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('description', mysql.TEXT(), nullable=True),
    sa.Column('status', mysql.VARCHAR(length=1), nullable=True),
    sa.Column('doc_num', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_table('user_tenant',
    sa.Column('id', mysql.VARCHAR(length=36), nullable=False),
    sa.Column('tenant_id', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('user_id', mysql.VARCHAR(length=32), nullable=True),
    sa.Column('role', mysql.VARCHAR(length=32), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    # ### end Alembic commands ###
