Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions alembic/versions/580fd6de4f15_converstaion_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Converstaion tags

Revision ID: 580fd6de4f15
Revises: 6868ac66ea92
Create Date: 2025-08-07 08:07:27.548324

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

# revision identifiers, used by Alembic.
revision = '580fd6de4f15'
down_revision = '6868ac66ea92'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('conversation_tag',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('name', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('config', sa.JSON(), nullable=True),
sa.ForeignKeyConstraint(['created_by'], ['user.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
schema='cognition'
)
op.create_index(op.f('ix_cognition_conversation_tag_created_by'), 'conversation_tag', ['created_by'], unique=False, schema='cognition')
op.create_table('conversation_tag_association',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('conversation_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('tag_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['conversation_id'], ['cognition.conversation.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['tag_id'], ['cognition.conversation_tag.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
schema='cognition'
)
op.create_index(op.f('ix_cognition_conversation_tag_association_conversation_id'), 'conversation_tag_association', ['conversation_id'], unique=False, schema='cognition')
op.create_index(op.f('ix_cognition_conversation_tag_association_tag_id'), 'conversation_tag_association', ['tag_id'], unique=False, schema='cognition')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_cognition_conversation_tag_association_tag_id'), table_name='conversation_tag_association', schema='cognition')
op.drop_index(op.f('ix_cognition_conversation_tag_association_conversation_id'), table_name='conversation_tag_association', schema='cognition')
op.drop_table('conversation_tag_association', schema='cognition')
op.drop_index(op.f('ix_cognition_conversation_tag_created_by'), table_name='conversation_tag', schema='cognition')
op.drop_table('conversation_tag', schema='cognition')
# ### end Alembic commands ###