lots of configuration progress.

This commit is contained in:
2025-08-06 15:38:49 -07:00
parent c6102dda45
commit 41ea8fb3bd
24 changed files with 2566 additions and 51 deletions

View File

@@ -0,0 +1,42 @@
"""processing email
Revision ID: 29a9c4ac0fc6
Revises: 9a88c7e94083
Create Date: 2025-08-06 11:40:52.702637
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '29a9c4ac0fc6'
down_revision = '9a88c7e94083'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('processed_emails',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('folder_id', sa.Integer(), nullable=False),
sa.Column('email_uid', sa.String(length=255), nullable=False),
sa.Column('folder_name', sa.String(length=255), nullable=False),
sa.Column('is_processed', sa.Boolean(), nullable=True),
sa.Column('first_seen_at', sa.DateTime(), nullable=True),
sa.Column('processed_at', sa.DateTime(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['folder_id'], ['folders.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('processed_emails')
# ### end Alembic commands ###

View File

@@ -0,0 +1,47 @@
"""Add folder_type and emails_count fields to Folder table
Revision ID: 7b6db971e3a4
Revises: 29a9c4ac0fc6
Create Date: 2025-08-06 12:25:13.415140
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7b6db971e3a4'
down_revision = '29a9c4ac0fc6'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
# Add new columns as nullable first
op.add_column('folders', sa.Column('folder_type', sa.String(length=20), nullable=True))
op.add_column('folders', sa.Column('emails_count', sa.Integer(), nullable=True))
# Set default values for existing records
# Set all existing folders to 'destination' type
op.execute("UPDATE folders SET folder_type = 'destination' WHERE folder_type IS NULL")
# Set 'inbox' folders to 'tidy' type
op.execute("UPDATE folders SET folder_type = 'tidy' WHERE folder_type IS NULL AND name ILIKE '%inbox%'")
# Now make folder_type NOT NULL
op.alter_column('folders', 'folder_type', nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
# Make column nullable again before dropping
op.alter_column('folders', 'folder_type', nullable=True)
# Drop the columns
op.drop_column('folders', 'emails_count')
op.drop_column('folders', 'folder_type')
# ### end Alembic commands ###