Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Парфенов Михаил Александрович committed Nov 30, 2024
1 parent a82a2bb commit cbf0015
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions migrations/versions/20181e0d6aab_make_nullable_timetable_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""make nullable timetable_id

Check failure on line 1 in migrations/versions/20181e0d6aab_make_nullable_timetable_id.py

View workflow job for this annotation

GitHub Actions / linting

Imports are incorrectly sorted and/or formatted.
Revision ID: 20181e0d6aab
Revises: edcc1a448ffb
Create Date: 2024-11-30 18:45:08.527638
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '20181e0d6aab'
down_revision = 'edcc1a448ffb'
branch_labels = None
depends_on = None


def upgrade():
op.drop_constraint('lecturer_timetable_id_key', 'lecturer', type_='unique')


def downgrade():
op.create_unique_constraint('lecturer_timetable_id_key', 'lecturer', ['timetable_id'])
2 changes: 1 addition & 1 deletion rating_api/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Lecturer(BaseDbModel):
last_name: Mapped[str] = mapped_column(String, nullable=False)
middle_name: Mapped[str] = mapped_column(String, nullable=False)
avatar_link: Mapped[str] = mapped_column(String, nullable=True)
timetable_id: Mapped[int] = mapped_column(Integer, unique=True, nullable=False)
timetable_id: Mapped[int]
comments: Mapped[list[Comment]] = relationship("Comment", back_populates="lecturer")
is_deleted: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)

Expand Down
2 changes: 1 addition & 1 deletion rating_api/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LecturerPost(Base):
last_name: str
middle_name: str
avatar_link: str | None = None
timetable_id: int
timetable_id: int | None = None


class LecturerPatch(Base):
Expand Down

0 comments on commit cbf0015

Please sign in to comment.