Skip to content

Commit

Permalink
Merge pull request #858 from trevorjob/dev
Browse files Browse the repository at this point in the history
fix: newsletter subscription
  • Loading branch information
johnson-oragui authored Aug 11, 2024
2 parents 6cc0519 + ea12a61 commit a9738c3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions alembic/versions/af8459ffc616_newsubs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""newsubs
Revision ID: af8459ffc616
Revises: e63f024c23eb
Create Date: 2024-08-11 17:43:47.369492
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'af8459ffc616'
down_revision: Union[str, None] = 'e63f024c23eb'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('newsletter_subscribers', 'newsletter_id',
existing_type=sa.VARCHAR(),
nullable=True)
op.drop_constraint('organisations_name_key', 'organisations', type_='unique')
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint('organisations_name_key', 'organisations', ['name'])
op.alter_column('newsletter_subscribers', 'newsletter_id',
existing_type=sa.VARCHAR(),
nullable=False)
# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion api/v1/models/newsletter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class NewsletterSubscriber(BaseTableModel):

email: Mapped[str] = mapped_column(String(120), nullable=False)
newsletter_id: Mapped[str] = mapped_column(
ForeignKey("newsletters.id"), nullable=False
ForeignKey("newsletters.id"), nullable=True
)

newsletter: Mapped["Newsletter"] = relationship(
Expand Down

0 comments on commit a9738c3

Please sign in to comment.