From e893272d3bc7209f90314d04fe8b0086a0de92a0 Mon Sep 17 00:00:00 2001 From: Son NK Date: Tue, 9 Apr 2024 13:33:41 +0200 Subject: [PATCH] add User.enable_data_breach_check column --- app/models.py | 5 ++++ .../versions/2024_040913_fa2f19bb4e5a_.py | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 migrations/versions/2024_040913_fa2f19bb4e5a_.py diff --git a/app/models.py b/app/models.py index 472b98a8..25d77bf3 100644 --- a/app/models.py +++ b/app/models.py @@ -525,6 +525,11 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle): sa.Boolean, default=True, nullable=False, server_default="1" ) + # user opted in for data breach check + enable_data_breach_check = sa.Column( + sa.Boolean, default=False, nullable=False, server_default="0" + ) + # bitwise flags. Allow for future expansion flags = sa.Column( sa.BigInteger, diff --git a/migrations/versions/2024_040913_fa2f19bb4e5a_.py b/migrations/versions/2024_040913_fa2f19bb4e5a_.py new file mode 100644 index 00000000..50919888 --- /dev/null +++ b/migrations/versions/2024_040913_fa2f19bb4e5a_.py @@ -0,0 +1,29 @@ +"""empty message + +Revision ID: fa2f19bb4e5a +Revises: 52510a633d6f +Create Date: 2024-04-09 13:12:26.305340 + +""" +import sqlalchemy_utils +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'fa2f19bb4e5a' +down_revision = '52510a633d6f' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('users', sa.Column('enable_data_breach_check', sa.Boolean(), server_default='0', nullable=False)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('users', 'enable_data_breach_check') + # ### end Alembic commands ###