Add User.disable_automatic_alias_note column

This commit is contained in:
Son 2021-10-23 17:40:57 +02:00
parent d41ab5f5de
commit 50b0dc3767
2 changed files with 35 additions and 0 deletions

View File

@ -375,6 +375,12 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
# cf https://flask-login.readthedocs.io/en/latest/#alternative-tokens
alternative_id = sa.Column(sa.String(128), unique=True, nullable=True)
# by default, when an alias is automatically created, a note like "Created with ...." is created
# If this field is True, the note won't be created.
disable_automatic_alias_note = 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: a06066e3fbeb
Revises: 99d9e329b27f
Create Date: 2021-10-23 17:39:42.459541
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a06066e3fbeb'
down_revision = '99d9e329b27f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('disable_automatic_alias_note', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'disable_automatic_alias_note')
# ### end Alembic commands ###