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
50 changes: 50 additions & 0 deletions alembic/versions/094dd28a1d8d_add_thread_association.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Add Thread association

Revision ID: 094dd28a1d8d
Revises: d02bf381e3ed
Create Date: 2025-11-15 19:07:22.805825

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

# revision identifiers, used by Alembic.
revision = '094dd28a1d8d'
down_revision = 'd02bf381e3ed'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('inbox_mail_thread_association',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('thread_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.ForeignKeyConstraint(['thread_id'], ['global.inbox_mail_thread.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
schema='global'
)
op.create_index(op.f('ix_global_inbox_mail_thread_association_thread_id'), 'inbox_mail_thread_association', ['thread_id'], unique=False, schema='global')
op.create_index(op.f('ix_global_inbox_mail_thread_association_user_id'), 'inbox_mail_thread_association', ['user_id'], unique=False, schema='global')
op.add_column('inbox_mail_thread', sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=True), schema='global')
op.drop_index('idx_inbox_thread_participants_gin', table_name='inbox_mail_thread', schema='global')
op.create_index(op.f('ix_global_inbox_mail_thread_created_by'), 'inbox_mail_thread', ['created_by'], unique=False, schema='global')
op.create_foreign_key(None, 'inbox_mail_thread', 'user', ['created_by'], ['id'], source_schema='global', ondelete='CASCADE')
op.drop_column('inbox_mail_thread', 'participant_ids', schema='global')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail_thread', sa.Column('participant_ids', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True), schema='global')
op.drop_constraint(None, 'inbox_mail_thread', schema='global', type_='foreignkey')
op.drop_index(op.f('ix_global_inbox_mail_thread_created_by'), table_name='inbox_mail_thread', schema='global')
op.create_index('idx_inbox_thread_participants_gin', 'inbox_mail_thread', ['participant_ids'], unique=False, schema='global')
op.drop_column('inbox_mail_thread', 'created_by', schema='global')
op.drop_index(op.f('ix_global_inbox_mail_thread_association_user_id'), table_name='inbox_mail_thread_association', schema='global')
op.drop_index(op.f('ix_global_inbox_mail_thread_association_thread_id'), table_name='inbox_mail_thread_association', schema='global')
op.drop_table('inbox_mail_thread_association', schema='global')
# ### end Alembic commands ###
28 changes: 28 additions & 0 deletions alembic/versions/8b89db0d41fd_unread_mail_count_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Unread mail count thread

Revision ID: 8b89db0d41fd
Revises: c95b049b0779
Create Date: 2025-11-17 14:28:02.843729

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8b89db0d41fd'
down_revision = 'c95b049b0779'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail_thread_association', sa.Column('unread_mail_count', sa.Integer(), nullable=True), schema='global')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('inbox_mail_thread_association', 'unread_mail_count', schema='global')
# ### end Alembic commands ###
62 changes: 62 additions & 0 deletions alembic/versions/b59188cf5526_change_inbox_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""Change inbox model

Revision ID: b59188cf5526
Revises: ebf4435d83f8
Create Date: 2025-11-12 10:01:36.389914

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

# revision identifiers, used by Alembic.
revision = 'b59188cf5526'
down_revision = 'ebf4435d83f8'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail', sa.Column('sender_id', postgresql.UUID(as_uuid=True), nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('recipient_id', postgresql.UUID(as_uuid=True), nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('other_recipient_ids', sa.JSON(), nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('thread_id', postgresql.UUID(as_uuid=True), nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('is_important', sa.Boolean(), nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('being_working_on', sa.Boolean(), nullable=True), schema='global')
op.drop_index('ix_global_inbox_mail_child_id', table_name='inbox_mail', schema='global')
op.create_index(op.f('ix_global_inbox_mail_recipient_id'), 'inbox_mail', ['recipient_id'], unique=False, schema='global')
op.create_index(op.f('ix_global_inbox_mail_sender_id'), 'inbox_mail', ['sender_id'], unique=False, schema='global')
op.create_index(op.f('ix_global_inbox_mail_thread_id'), 'inbox_mail', ['thread_id'], unique=False, schema='global')
op.drop_constraint('inbox_mail_child_id_fkey', 'inbox_mail', schema='global', type_='foreignkey')
op.create_foreign_key(None, 'inbox_mail', 'user', ['sender_id'], ['id'], source_schema='global', ondelete='SET NULL')
op.create_foreign_key(None, 'inbox_mail', 'user', ['recipient_id'], ['id'], source_schema='global', ondelete='CASCADE')
op.drop_column('inbox_mail', 'mark_as_important', schema='global')
op.drop_column('inbox_mail', 'being_worked_on', schema='global')
op.drop_column('inbox_mail', 'child_id', schema='global')
op.drop_column('inbox_mail', 'send_from', schema='global')
op.drop_column('inbox_mail', 'send_to', schema='global')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail', sa.Column('send_to', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('send_from', sa.VARCHAR(), autoincrement=False, nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('child_id', postgresql.UUID(), autoincrement=False, nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('being_worked_on', sa.BOOLEAN(), autoincrement=False, nullable=True), schema='global')
op.add_column('inbox_mail', sa.Column('mark_as_important', sa.BOOLEAN(), autoincrement=False, nullable=True), schema='global')
op.drop_constraint(None, 'inbox_mail', schema='global', type_='foreignkey')
op.drop_constraint(None, 'inbox_mail', schema='global', type_='foreignkey')
op.create_foreign_key('inbox_mail_child_id_fkey', 'inbox_mail', 'inbox_mail', ['child_id'], ['id'], source_schema='global', referent_schema='global', ondelete='SET NULL')
op.drop_index(op.f('ix_global_inbox_mail_thread_id'), table_name='inbox_mail', schema='global')
op.drop_index(op.f('ix_global_inbox_mail_sender_id'), table_name='inbox_mail', schema='global')
op.drop_index(op.f('ix_global_inbox_mail_recipient_id'), table_name='inbox_mail', schema='global')
op.create_index('ix_global_inbox_mail_child_id', 'inbox_mail', ['child_id'], unique=False, schema='global')
op.drop_column('inbox_mail', 'being_working_on', schema='global')
op.drop_column('inbox_mail', 'is_important', schema='global')
op.drop_column('inbox_mail', 'thread_id', schema='global')
op.drop_column('inbox_mail', 'other_recipient_ids', schema='global')
op.drop_column('inbox_mail', 'recipient_id', schema='global')
op.drop_column('inbox_mail', 'sender_id', schema='global')
# ### end Alembic commands ###
30 changes: 30 additions & 0 deletions alembic/versions/c95b049b0779_rename_working_on.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Rename working on

Revision ID: c95b049b0779
Revises: 094dd28a1d8d
Create Date: 2025-11-17 10:58:16.971432

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'c95b049b0779'
down_revision = '094dd28a1d8d'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail_thread', sa.Column('is_in_progress', sa.Boolean(), nullable=True), schema='global')
op.drop_column('inbox_mail_thread', 'being_working_on', schema='global')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail_thread', sa.Column('being_working_on', sa.BOOLEAN(), autoincrement=False, nullable=True), schema='global')
op.drop_column('inbox_mail_thread', 'is_in_progress', schema='global')
# ### end Alembic commands ###
36 changes: 36 additions & 0 deletions alembic/versions/cbc8f102510c_progress_state_inbox_mial_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Progress state inbox mial thread

Revision ID: cbc8f102510c
Revises: 8b89db0d41fd
Create Date: 2025-11-18 14:23:36.853407

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

# revision identifiers, used by Alembic.
revision = 'cbc8f102510c'
down_revision = '8b89db0d41fd'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail_thread', sa.Column('progress_state', sa.String(), nullable=True), schema='global')
op.add_column('inbox_mail_thread', sa.Column('support_owner_id', postgresql.UUID(as_uuid=True), nullable=True), schema='global')
op.create_index(op.f('ix_global_inbox_mail_thread_support_owner_id'), 'inbox_mail_thread', ['support_owner_id'], unique=False, schema='global')
op.create_foreign_key(None, 'inbox_mail_thread', 'user', ['support_owner_id'], ['id'], source_schema='global', ondelete='SET NULL')
op.drop_column('inbox_mail_thread', 'is_in_progress', schema='global')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('inbox_mail_thread', sa.Column('is_in_progress', sa.BOOLEAN(), autoincrement=False, nullable=True), schema='global')
op.drop_constraint(None, 'inbox_mail_thread', schema='global', type_='foreignkey')
op.drop_index(op.f('ix_global_inbox_mail_thread_support_owner_id'), table_name='inbox_mail_thread', schema='global')
op.drop_column('inbox_mail_thread', 'support_owner_id', schema='global')
op.drop_column('inbox_mail_thread', 'progress_state', schema='global')
# ### end Alembic commands ###
Loading