Skip to content

Commit

Permalink
Merge pull request #3411 from HHS/update-project-short-title
Browse files Browse the repository at this point in the history
feat: remove constraint from project short_title
  • Loading branch information
johndeange authored Feb 5, 2025
2 parents 7c2ad4f + 19c3d0b commit 9308e86
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""remove constraint from project short_title
Revision ID: c9a2b729be0e
Revises: baeefc8305f1
Create Date: 2025-02-03 15:49:36.094504+00:00
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = 'c9a2b729be0e'
down_revision: Union[str, None] = 'baeefc8305f1'
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('project', 'short_title',
existing_type=sa.VARCHAR(),
nullable=True)
op.drop_constraint('project_short_title_key', 'project', type_='unique')
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint('project_short_title_key', 'project', ['short_title'])
op.alter_column('project', 'short_title',
existing_type=sa.VARCHAR(),
nullable=False)
# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion backend/models/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Project(BaseModel):
)
project_type: Mapped[ProjectType] = mapped_column(ENUM(ProjectType), nullable=False)
title: Mapped[str] = mapped_column(String(), nullable=False)
short_title: Mapped[str] = mapped_column(String(), nullable=False, unique=True)
short_title: Mapped[Optional[str]] = mapped_column(String(), nullable=True)
description: Mapped[str] = mapped_column(Text(), nullable=False, default="")
url: Mapped[Optional[str]] = mapped_column(Text(), nullable=True)

Expand Down

0 comments on commit 9308e86

Please sign in to comment.