added messgage bundel not all at one, added sepearte memory at every filter
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""add rule_id to processed_mails
|
||||
|
||||
Revision ID: c14c86cbc9c0
|
||||
Revises: 0ef2a4f77557
|
||||
Create Date: 2026-03-19 15:46:32.787129
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'c14c86cbc9c0'
|
||||
down_revision: Union[str, Sequence[str], None] = '0ef2a4f77557'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# Alte processed_mails ohne rule_id löschen — werden beim nächsten Poll neu erstellt
|
||||
op.execute("DELETE FROM processed_mails")
|
||||
|
||||
with op.batch_alter_table('processed_mails', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('rule_id', sa.Integer(), nullable=False))
|
||||
batch_op.create_index(batch_op.f('ix_processed_mails_rule_id'), ['rule_id'], unique=False)
|
||||
batch_op.create_foreign_key('fk_processed_mails_rule_id', 'filter_rules', ['rule_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('processed_mails', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_index(batch_op.f('ix_processed_mails_rule_id'))
|
||||
batch_op.drop_column('rule_id')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user