Add the relay concept to the model

master
kaiyou 7 years ago
parent 64ded60b5e
commit b5c55d10d3

@ -116,6 +116,20 @@ class Alternative(Base):
return self.name
class Relay(Base):
""" Relayed mail domain.
The domain is either relayed publicly or through a specified SMTP host.
"""
__tablename__ = "relay"
name = db.Column(db.String(80), primary_key=True, nullable=False)
smtp = db.Column(db.String(80), nullable=True)
def __str__(self):
return self.name
class Email(object):
""" Abstraction for an email address (localpart and domain).
"""

@ -0,0 +1,29 @@
""" Add relayed domains
Revision ID: c162ac88012a
Revises: c9a0b4e653cf
Create Date: 2017-09-10 20:21:10.011969
"""
# revision identifiers, used by Alembic.
revision = 'c162ac88012a'
down_revision = 'c9a0b4e653cf'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('relay',
sa.Column('created_at', sa.Date(), nullable=False),
sa.Column('updated_at', sa.Date(), nullable=True),
sa.Column('comment', sa.String(length=255), nullable=True),
sa.Column('name', sa.String(length=80), nullable=False),
sa.Column('smtp', sa.String(length=80), nullable=True),
sa.PrimaryKeyConstraint('name')
)
def downgrade():
op.drop_table('relay')
Loading…
Cancel
Save