Add IgnoreBounceSender model

This commit is contained in:
Son Nguyen Kim 2021-08-02 11:30:29 +02:00
parent 383cd49f25
commit 6dac717c75
2 changed files with 45 additions and 0 deletions

View File

@ -2340,3 +2340,12 @@ class IgnoredEmail(db.Model, ModelMixin):
mail_from = db.Column(db.String(512), nullable=False)
rcpt_to = db.Column(db.String(512), nullable=False)
class IgnoreBounceSender(db.Model, ModelMixin):
"""Ignore sender that doesn't correctly handle bounces, for example noreply@github.com"""
mail_from = db.Column(db.String(512), nullable=False, unique=True)
def __repr__(self):
return f"<NoReplySender {self.mail_from}"

View File

@ -0,0 +1,36 @@
"""empty message
Revision ID: ffa75d04e6ef
Revises: c3470e2d3224
Create Date: 2021-08-02 11:30:05.509051
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ffa75d04e6ef'
down_revision = 'c3470e2d3224'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('ignore_bounce_sender',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('mail_from', sa.String(length=512), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('mail_from')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('ignore_bounce_sender')
# ### end Alembic commands ###