Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
61 changes: 61 additions & 0 deletions alembic/versions/77f1ea22a633_add_conversation_shares.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Add conversation shares

Revision ID: 77f1ea22a633
Revises: 199a0d8aefbe
Create Date: 2025-10-30 10:01:12.869034

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

# revision identifiers, used by Alembic.
revision = '77f1ea22a633'
down_revision = '199a0d8aefbe'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('conversation_global_share',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('conversation_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('shared_by', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['conversation_id'], ['cognition.conversation.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['shared_by'], ['user.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
schema='cognition'
)
op.create_index(op.f('ix_cognition_conversation_global_share_conversation_id'), 'conversation_global_share', ['conversation_id'], unique=False, schema='cognition')
op.create_index(op.f('ix_cognition_conversation_global_share_shared_by'), 'conversation_global_share', ['shared_by'], unique=False, schema='cognition')
op.create_table('conversation_share',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('conversation_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('shared_with', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('shared_by', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('can_copy', sa.Boolean(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['conversation_id'], ['cognition.conversation.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['shared_by'], ['user.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['shared_with'], ['user.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
schema='cognition'
)
op.create_index(op.f('ix_cognition_conversation_share_conversation_id'), 'conversation_share', ['conversation_id'], unique=False, schema='cognition')
op.create_index(op.f('ix_cognition_conversation_share_shared_by'), 'conversation_share', ['shared_by'], unique=False, schema='cognition')
op.create_index(op.f('ix_cognition_conversation_share_shared_with'), 'conversation_share', ['shared_with'], unique=False, schema='cognition')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_cognition_conversation_share_shared_with'), table_name='conversation_share', schema='cognition')
op.drop_index(op.f('ix_cognition_conversation_share_shared_by'), table_name='conversation_share', schema='cognition')
op.drop_index(op.f('ix_cognition_conversation_share_conversation_id'), table_name='conversation_share', schema='cognition')
op.drop_table('conversation_share', schema='cognition')
op.drop_index(op.f('ix_cognition_conversation_global_share_shared_by'), table_name='conversation_global_share', schema='cognition')
op.drop_index(op.f('ix_cognition_conversation_global_share_conversation_id'), table_name='conversation_global_share', schema='cognition')
op.drop_table('conversation_global_share', schema='cognition')
# ### end Alembic commands ###
30 changes: 30 additions & 0 deletions alembic/versions/85bb3ebee137_add_project_conv_share_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""add project conv share settings

Revision ID: 85bb3ebee137
Revises: 77f1ea22a633
Create Date: 2025-11-03 12:55:02.413126

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '85bb3ebee137'
down_revision = '77f1ea22a633'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('project', sa.Column('allow_conversation_sharing_organization', sa.Boolean(), nullable=True), schema='cognition')
op.add_column('project', sa.Column('allow_conversation_sharing_global', sa.Boolean(), nullable=True), schema='cognition')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('project', 'allow_conversation_sharing_global', schema='cognition')
op.drop_column('project', 'allow_conversation_sharing_organization', schema='cognition')
# ### end Alembic commands ###