Create Bounce, TransactionalEmail models

This commit is contained in:
Son NK 2021-01-26 09:54:26 +01:00
parent e09e6c51b8
commit 1013e8dd79
2 changed files with 61 additions and 0 deletions

View File

@ -2111,3 +2111,18 @@ class Metric(db.Model, ModelMixin):
NB_VERIFIED_CUSTOM_DOMAIN = "nb_verified_custom_domain"
NB_APP = "nb_app"
class Bounce(db.Model, ModelMixin):
"""Record all bounces. Deleted after 7 days
"""
email = db.Column(db.String(256), nullable=False, index=True)
class TransactionalEmail(db.Model, ModelMixin):
"""Storing all email addresses that receive transactional emails, including account email and mailboxes.
Deleted after 7 days
"""
email = db.Column(db.String(256), nullable=False, unique=True)

View File

@ -0,0 +1,46 @@
"""empty message
Revision ID: 74906d31d994
Revises: 2779eb90c6c4
Create Date: 2021-01-26 09:53:58.010247
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '74906d31d994'
down_revision = '2779eb90c6c4'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('bounce',
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('email', sa.String(length=256), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_bounce_email'), 'bounce', ['email'], unique=False)
op.create_table('transactional_email',
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('email', sa.String(length=256), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('transactional_email')
op.drop_index(op.f('ix_bounce_email'), table_name='bounce')
op.drop_table('bounce')
# ### end Alembic commands ###