"""added_config_type_for_system_prompt

Revision ID: f5c4562bcd86
Revises: 1e7f3dc15e9c
Create Date: 2024-05-13 18:42:47.952204

"""
from typing import Sequence, Union

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

# revision identifiers, used by Alembic.
revision: str = 'f5c4562bcd86'
down_revision: Union[str, None] = '1e7f3dc15e9c'
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('langchain_pg_embedding')
    # op.drop_table('llm_cache_fulltext')
    # op.drop_table('langchain_pg_collection')
        op.execute("ALTER TYPE configtype ADD VALUE 'SYSTEM_PROMPT'")
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('langchain_pg_collection',
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('cmetadata', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=True),
    sa.Column('uuid', sa.UUID(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('uuid', name='langchain_pg_collection_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('llm_cache_fulltext',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('pipeline_id', sa.UUID(), autoincrement=False, nullable=False),
    sa.Column('question', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('llm', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('response', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='llm_cache_fulltext_pkey')
    )
    op.create_table('langchain_pg_embedding',
    sa.Column('collection_id', sa.UUID(), autoincrement=False, nullable=True),
    sa.Column('embedding', sa.NullType(), autoincrement=False, nullable=True),
    sa.Column('document', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('cmetadata', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=True),
    sa.Column('custom_id', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('uuid', sa.UUID(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['collection_id'], ['langchain_pg_collection.uuid'], name='langchain_pg_embedding_collection_id_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('uuid', name='langchain_pg_embedding_pkey')
    )
    # ### end Alembic commands ###
