diff --git a/alembic/versions/77f1ea22a633_add_conversation_shares.py b/alembic/versions/77f1ea22a633_add_conversation_shares.py new file mode 100644 index 00000000..1626db02 --- /dev/null +++ b/alembic/versions/77f1ea22a633_add_conversation_shares.py @@ -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 ### diff --git a/alembic/versions/85bb3ebee137_add_project_conv_share_settings.py b/alembic/versions/85bb3ebee137_add_project_conv_share_settings.py new file mode 100644 index 00000000..391f63f1 --- /dev/null +++ b/alembic/versions/85bb3ebee137_add_project_conv_share_settings.py @@ -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 ### diff --git a/submodules/model b/submodules/model index c996e22c..a184024c 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit c996e22c1ec38ef43a46b495aa1e450a8383df50 +Subproject commit a184024c56dd04dff359112256893aa23d052917