Add EmailLog.message_id, sl_message_id and MessageIDMatching table
This commit is contained in:
parent
462164ff16
commit
1483f2e103
|
@ -1622,6 +1622,11 @@ class EmailLog(Base, ModelMixin):
|
||||||
sa.ForeignKey("mailbox.id", ondelete="cascade"), nullable=True
|
sa.ForeignKey("mailbox.id", ondelete="cascade"), nullable=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# the Message ID
|
||||||
|
message_id = deferred(sa.Column(sa.String(512), nullable=True))
|
||||||
|
# in the reply phase, the original message_id is replaced by the SL message_id
|
||||||
|
sl_message_id = deferred(sa.Column(sa.String(512), nullable=True))
|
||||||
|
|
||||||
refused_email = orm.relationship("RefusedEmail")
|
refused_email = orm.relationship("RefusedEmail")
|
||||||
forward = orm.relationship(Contact)
|
forward = orm.relationship(Contact)
|
||||||
|
|
||||||
|
@ -2566,3 +2571,13 @@ class IgnoreBounceSender(Base, ModelMixin):
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<NoReplySender {self.mail_from}"
|
return f"<NoReplySender {self.mail_from}"
|
||||||
|
|
||||||
|
|
||||||
|
class MessageIDMatching(Base, ModelMixin):
|
||||||
|
"""Store the SL Message ID and the original Message ID"""
|
||||||
|
|
||||||
|
__tablename__ = "message_id_matching"
|
||||||
|
|
||||||
|
# SimpleLogin Message ID
|
||||||
|
sl_message_id = sa.Column(sa.String(512), unique=True, nullable=False)
|
||||||
|
original_message_id = sa.Column(sa.String(512), unique=True, nullable=False)
|
||||||
|
|
42
migrations/versions/2021_101817_99d9e329b27f_.py
Normal file
42
migrations/versions/2021_101817_99d9e329b27f_.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 99d9e329b27f
|
||||||
|
Revises: 2f1b3c759773
|
||||||
|
Create Date: 2021-10-18 17:15:29.903802
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '99d9e329b27f'
|
||||||
|
down_revision = '2f1b3c759773'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('message_id_matching',
|
||||||
|
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('sl_message_id', sa.String(length=512), nullable=False),
|
||||||
|
sa.Column('original_message_id', sa.String(length=512), nullable=False),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('original_message_id'),
|
||||||
|
sa.UniqueConstraint('sl_message_id')
|
||||||
|
)
|
||||||
|
op.add_column('email_log', sa.Column('message_id', sa.String(length=512), nullable=True))
|
||||||
|
op.add_column('email_log', sa.Column('sl_message_id', sa.String(length=512), nullable=True))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('email_log', 'sl_message_id')
|
||||||
|
op.drop_column('email_log', 'message_id')
|
||||||
|
op.drop_table('message_id_matching')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in a new issue