Add User.include_sender_in_reverse_alias column. Null for existing user, False for new user.

This commit is contained in:
Son NK 2020-12-06 19:25:55 +01:00
parent 2d9abe0ea4
commit eab09d8c32
2 changed files with 34 additions and 0 deletions

View File

@ -272,6 +272,11 @@ class User(db.Model, ModelMixin, UserMixin):
db.ForeignKey("alias.id", ondelete="SET NULL"), nullable=True, default=None
)
# whether to include the sender address in reverse-alias
include_sender_in_reverse_alias = db.Column(
db.Boolean, default=False, nullable=True
)
@classmethod
def create(cls, email, name, password=None, **kwargs):
user: User = super(User, cls).create(email=email, name=name, **kwargs)

View File

@ -0,0 +1,29 @@
"""empty message
Revision ID: c0d91ff18f77
Revises: 56c790ec8ab4
Create Date: 2020-12-06 19:28:11.733022
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c0d91ff18f77'
down_revision = '56c790ec8ab4'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('include_sender_in_reverse_alias', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'include_sender_in_reverse_alias')
# ### end Alembic commands ###