"""Introduction of EveAIDataCapsule model

Revision ID: 5e3dd539e5c1
Revises: 26e8f0d8c143
Create Date: 2025-07-24 13:31:46.238128

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

# revision identifiers, used by Alembic.
revision = '5e3dd539e5c1'
down_revision = '26e8f0d8c143'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('eve_ai_data_capsule',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('chat_session_id', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=50), nullable=False),
    sa.Column('type_version', sa.String(length=20), nullable=True),
    sa.Column('configuration', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('created_by', sa.Integer(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_by', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['chat_session_id'], ['chat_session.id'], ),
    sa.ForeignKeyConstraint(['created_by'], ['public.user.id'], ),
    sa.ForeignKeyConstraint(['updated_by'], ['public.user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('chat_session_id', 'type', 'type_version', name='uix_data_capsule_session_type_version')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('eve_ai_data_capsule')
    # ### end Alembic commands ###
