Add User.one_click_unsubscribe_block_sender column

This commit is contained in:
Son 2021-11-02 15:41:49 +01:00
parent caa8656748
commit 368a2f1b47
2 changed files with 35 additions and 0 deletions

View file

@ -381,6 +381,12 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
sa.Boolean, default=False, nullable=False, server_default="0"
)
# By default, the one-click unsubscribe disable the alias
# If set to true, it will block the sender instead
one_click_unsubscribe_block_sender = sa.Column(
sa.Boolean, default=False, nullable=False, server_default="0"
)
# implement flask-login "alternative token"
def get_id(self):
if self.alternative_id:

View file

@ -0,0 +1,29 @@
"""empty message
Revision ID: ff6c04869029
Revises: 37feaba7c45d
Create Date: 2021-11-02 15:25:51.898330
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ff6c04869029'
down_revision = '37feaba7c45d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('one_click_unsubscribe_block_sender', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'one_click_unsubscribe_block_sender')
# ### end Alembic commands ###