From 50b0dc376767ef458fc9103149165d834c11ec2f Mon Sep 17 00:00:00 2001 From: Son Date: Sat, 23 Oct 2021 17:40:57 +0200 Subject: [PATCH] Add User.disable_automatic_alias_note column --- app/models.py | 6 ++++ .../versions/2021_102317_a06066e3fbeb_.py | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 migrations/versions/2021_102317_a06066e3fbeb_.py diff --git a/app/models.py b/app/models.py index 819b134b..2d8fe1df 100644 --- a/app/models.py +++ b/app/models.py @@ -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: diff --git a/migrations/versions/2021_102317_a06066e3fbeb_.py b/migrations/versions/2021_102317_a06066e3fbeb_.py new file mode 100644 index 00000000..9ae49a53 --- /dev/null +++ b/migrations/versions/2021_102317_a06066e3fbeb_.py @@ -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 ###