Skip to content

Commit

Permalink
Merge branch 'develop' into fix/statisitcs-by-created_at-631
Browse files Browse the repository at this point in the history
  • Loading branch information
gorskyolga authored Aug 25, 2024
2 parents 865a26c + f58cd33 commit 0c0ccf0
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""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_new_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False),
)
op.add_column(
"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_my_tasks", sa.Boolean(), server_default=sa.text("false"), nullable=False),
)
op.add_column(
"external_site_users",
sa.Column("has_mailing_procharity", sa.Boolean(), server_default=sa.text("false"), nullable=False),
)
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -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 ###
8 changes: 4 additions & 4 deletions src/core/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"<SiteUser {self.id}>"
Expand Down

0 comments on commit 0c0ccf0

Please sign in to comment.