"""Removed obsolete interaction fields, added specialist relation to interaction

Revision ID: 7872ffdbac6c
Revises: 2370a17da7cb
Create Date: 2024-11-07 15:14:12.263011

"""
from alembic import op
import sqlalchemy as sa
import pgvector


# revision identifiers, used by Alembic.
revision = '7872ffdbac6c'
down_revision = '2370a17da7cb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('interaction', sa.Column('specialist_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'interaction', 'specialist', ['specialist_id'], ['id'])
    op.drop_column('interaction', 'question')
    op.drop_column('interaction', 'answer')
    op.drop_column('interaction', 'algorithm_used')
    op.drop_column('interaction', 'language')
    op.drop_column('interaction', 'detailed_question')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('interaction', sa.Column('detailed_question', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('interaction', sa.Column('language', sa.VARCHAR(length=2), autoincrement=False, nullable=False))
    op.add_column('interaction', sa.Column('algorithm_used', sa.VARCHAR(length=20), autoincrement=False, nullable=True))
    op.add_column('interaction', sa.Column('answer', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('interaction', sa.Column('question', sa.TEXT(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'interaction', type_='foreignkey')
    op.drop_column('interaction', 'specialist_id')
    # ### end Alembic commands ###
