diff --git a/migrations/versions/fee34ac4fcab_delete_user_id_from_lectureruser.py b/migrations/versions/fee34ac4fcab_delete_user_id_from_lectureruser.py new file mode 100644 index 0000000..5026086 --- /dev/null +++ b/migrations/versions/fee34ac4fcab_delete_user_id_from_lectureruser.py @@ -0,0 +1,25 @@ +"""delete-user-id-from-lectureruser + +Revision ID: fee34ac4fcab +Revises: 0fbda260a023 +Create Date: 2024-11-10 02:38:49.538788 + +""" + +import sqlalchemy as sa +from alembic import op + + + +revision = 'fee34ac4fcab' +down_revision = '0fbda260a023' +branch_labels = None +depends_on = None + + +def upgrade(): + op.drop_column('lecturer_user_comment', 'user_id') + + +def downgrade(): + op.add_column('lecturer_user_comment', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False)) diff --git a/rating_api/models/db.py b/rating_api/models/db.py index eeaaa47..52a7ff2 100644 --- a/rating_api/models/db.py +++ b/rating_api/models/db.py @@ -72,6 +72,5 @@ class Comment(BaseDbModel): class LecturerUserComment(BaseDbModel): id: Mapped[int] = mapped_column(Integer, primary_key=True) lecturer_id: Mapped[int] = mapped_column(Integer, ForeignKey("lecturer.id")) - user_id: Mapped[int] = mapped_column(Integer, nullable=False) create_ts: Mapped[datetime.datetime] = mapped_column(DateTime, default=datetime.datetime.utcnow, nullable=False) update_ts: Mapped[datetime.datetime] = mapped_column(DateTime, default=datetime.datetime.utcnow, nullable=False) diff --git a/rating_api/schemas/models.py b/rating_api/schemas/models.py index 357c782..de510a8 100644 --- a/rating_api/schemas/models.py +++ b/rating_api/schemas/models.py @@ -9,7 +9,7 @@ class CommentGet(Base): uuid: UUID - user_id: int | None + user_id: int | None = None create_ts: datetime.datetime update_ts: datetime.datetime subject: str