Add EmailLog.spam_report column

This commit is contained in:
Son NK 2021-01-04 14:38:32 +01:00
parent b942b44ec8
commit 8dbaf3cf56
2 changed files with 32 additions and 0 deletions

View File

@ -10,6 +10,7 @@ from arrow import Arrow
from flask import url_for
from flask_login import UserMixin
from sqlalchemy import text, desc, CheckConstraint
from sqlalchemy.orm import deferred
from sqlalchemy_utils import ArrowType
from app import s3
@ -1354,6 +1355,8 @@ class EmailLog(db.Model, ModelMixin):
is_spam = db.Column(db.Boolean, nullable=False, default=False, server_default="0")
spam_score = db.Column(db.Float, nullable=True)
spam_status = db.Column(db.Text, nullable=True, default=None)
# do not load this column
spam_report = deferred(db.Column(db.JSON, nullable=True))
# Point to the email that has been refused
refused_email_id = db.Column(

View File

@ -0,0 +1,29 @@
"""empty message
Revision ID: e99989e6ad56
Revises: 7c0dbd378cdb
Create Date: 2021-01-04 14:31:12.163039
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e99989e6ad56'
down_revision = '7c0dbd378cdb'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('email_log', sa.Column('spam_report', sa.JSON(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('email_log', 'spam_report')
# ### end Alembic commands ###