From a86b56b9a2f188d8edd2a973f8aa6be8dbdd2dcf Mon Sep 17 00:00:00 2001 From: Olga Avdeeva Date: Sat, 24 Aug 2024 15:19:04 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8=20=D0=B8=20?= =?UTF-8?q?=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=B9=20=D0=BD=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=B5=D0=BA=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20.46.07_add_notification_settings_to_ext_site_user.py | 8 ++++---- src/core/db/models.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py b/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py index ea80d17e..17738f03 100644 --- a/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py +++ b/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py @@ -20,19 +20,19 @@ def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column( "external_site_users", - sa.Column("has_mailing_new_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False), + sa.Column("has_mailing_new_tasks", sa.Boolean(), nullable=True), ) op.add_column( "external_site_users", - sa.Column("has_mailing_profile", sa.Boolean(), server_default=sa.text("false"), nullable=False), + sa.Column("has_mailing_profile", sa.Boolean(), nullable=True), ) op.add_column( "external_site_users", - sa.Column("has_mailing_my_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False), + sa.Column("has_mailing_my_tasks", sa.Boolean(), nullable=True), ) op.add_column( "external_site_users", - sa.Column("has_mailing_procharity", sa.Boolean(), server_default=sa.text("false"), nullable=False), + sa.Column("has_mailing_procharity", sa.Boolean(), nullable=True), ) # ### end Alembic commands ### diff --git a/src/core/db/models.py b/src/core/db/models.py index f3e83b78..5ef4bfbd 100644 --- a/src/core/db/models.py +++ b/src/core/db/models.py @@ -112,10 +112,10 @@ class ExternalSiteUser(ArchivableBase): task_responses: Mapped[list["Task"]] = relationship( secondary="task_response_volunteer", back_populates="responded_volunteers" ) - has_mailing_new_tasks: Mapped[bool] = mapped_column(server_default=expression.false()) - has_mailing_profile: Mapped[bool] = mapped_column(server_default=expression.false()) - has_mailing_my_tasks: Mapped[bool] = mapped_column(server_default=expression.false()) - has_mailing_procharity: Mapped[bool] = mapped_column(server_default=expression.false()) + has_mailing_new_tasks: Mapped[bool] = mapped_column(nullable=True) + has_mailing_profile: Mapped[bool] = mapped_column(nullable=True) + has_mailing_my_tasks: Mapped[bool] = mapped_column(nullable=True) + has_mailing_procharity: Mapped[bool] = mapped_column(nullable=True) def __repr__(self): return f"" From 0908b3c242af6fc0a8dff9da969585c674fcb6c0 Mon Sep 17 00:00:00 2001 From: Olga Avdeeva Date: Sat, 24 Aug 2024 18:02:32 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=B4=D0=B2=D1=83=D0=BC=D1=8F=20=D0=BC=D0=B8=D0=B3=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._notification_settings_to_ext_site_user.py | 8 ++-- ...8-24_17.48.49_drop_notifications_fields.py | 42 +++++++++++++++++++ ..._notification_settings_to_ext_site_user.py | 34 +++++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py create mode 100644 src/core/db/migrations/versions/2024-08-24_17.55.34_add_notification_settings_to_ext_site_user.py diff --git a/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py b/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py index 17738f03..ea80d17e 100644 --- a/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py +++ b/src/core/db/migrations/versions/2024-08-22_20.46.07_add_notification_settings_to_ext_site_user.py @@ -20,19 +20,19 @@ def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column( "external_site_users", - sa.Column("has_mailing_new_tasks", sa.Boolean(), nullable=True), + sa.Column("has_mailing_new_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) op.add_column( "external_site_users", - sa.Column("has_mailing_profile", sa.Boolean(), nullable=True), + sa.Column("has_mailing_profile", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) op.add_column( "external_site_users", - sa.Column("has_mailing_my_tasks", sa.Boolean(), nullable=True), + sa.Column("has_mailing_my_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) op.add_column( "external_site_users", - sa.Column("has_mailing_procharity", sa.Boolean(), nullable=True), + sa.Column("has_mailing_procharity", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) # ### end Alembic commands ### diff --git a/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py b/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py new file mode 100644 index 00000000..1b056807 --- /dev/null +++ b/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py @@ -0,0 +1,42 @@ +"""drop notifications fields + +Revision ID: 797114cc8d65 +Revises: 837378a2a99e +Create Date: 2024-08-24 17:48:49.721606 + +""" + +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "797114cc8d65" +down_revision = "837378a2a99e" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("external_site_users", "has_mailing_my_tasks") + op.drop_column("external_site_users", "has_mailing_new_tasks") + op.drop_column("external_site_users", "has_mailing_procharity") + op.drop_column("external_site_users", "has_mailing_profile") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "external_site_users", sa.Column("has_mailing_profile", sa.BOOLEAN(), autoincrement=False, nullable=True) + ) + op.add_column( + "external_site_users", sa.Column("has_mailing_procharity", sa.BOOLEAN(), autoincrement=False, nullable=True) + ) + op.add_column( + "external_site_users", sa.Column("has_mailing_new_tasks", sa.BOOLEAN(), autoincrement=False, nullable=True) + ) + op.add_column( + "external_site_users", sa.Column("has_mailing_my_tasks", sa.BOOLEAN(), autoincrement=False, nullable=True) + ) + # ### end Alembic commands ### diff --git a/src/core/db/migrations/versions/2024-08-24_17.55.34_add_notification_settings_to_ext_site_user.py b/src/core/db/migrations/versions/2024-08-24_17.55.34_add_notification_settings_to_ext_site_user.py new file mode 100644 index 00000000..1722cb92 --- /dev/null +++ b/src/core/db/migrations/versions/2024-08-24_17.55.34_add_notification_settings_to_ext_site_user.py @@ -0,0 +1,34 @@ +"""Add notification settings to ExternalSiteUser + +Revision ID: b155a83b9476 +Revises: 797114cc8d65 +Create Date: 2024-08-24 17:55:34.695567 + +""" + +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "b155a83b9476" +down_revision = "797114cc8d65" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column("external_site_users", sa.Column("has_mailing_new_tasks", sa.Boolean(), nullable=True)) + op.add_column("external_site_users", sa.Column("has_mailing_profile", sa.Boolean(), nullable=True)) + op.add_column("external_site_users", sa.Column("has_mailing_my_tasks", sa.Boolean(), nullable=True)) + op.add_column("external_site_users", sa.Column("has_mailing_procharity", sa.Boolean(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("external_site_users", "has_mailing_procharity") + op.drop_column("external_site_users", "has_mailing_my_tasks") + op.drop_column("external_site_users", "has_mailing_profile") + op.drop_column("external_site_users", "has_mailing_new_tasks") + # ### end Alembic commands ### From d0feb2110b828d0fcaaa3976ec6ab9dad2393c44 Mon Sep 17 00:00:00 2001 From: Olga Avdeeva Date: Sun, 25 Aug 2024 11:08:37 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20downgrade=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2024-08-24_17.48.49_drop_notifications_fields.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py b/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py index 1b056807..22e6da3a 100644 --- a/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py +++ b/src/core/db/migrations/versions/2024-08-24_17.48.49_drop_notifications_fields.py @@ -28,15 +28,19 @@ def upgrade() -> None: def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column( - "external_site_users", sa.Column("has_mailing_profile", sa.BOOLEAN(), autoincrement=False, nullable=True) + "external_site_users", + sa.Column("has_mailing_new_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) op.add_column( - "external_site_users", sa.Column("has_mailing_procharity", sa.BOOLEAN(), autoincrement=False, nullable=True) + "external_site_users", + sa.Column("has_mailing_profile", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) op.add_column( - "external_site_users", sa.Column("has_mailing_new_tasks", sa.BOOLEAN(), autoincrement=False, nullable=True) + "external_site_users", + sa.Column("has_mailing_my_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) op.add_column( - "external_site_users", sa.Column("has_mailing_my_tasks", sa.BOOLEAN(), autoincrement=False, nullable=True) + "external_site_users", + sa.Column("has_mailing_procharity", sa.Boolean(), server_default=sa.text("false"), nullable=False), ) # ### end Alembic commands ###