Skip to content

Commit

Permalink
Merge pull request #32 from profcomff/useridanon
Browse files Browse the repository at this point in the history
Added nullable user_id to Comment
  • Loading branch information
zipperman1 authored Nov 8, 2024
2 parents fbf7b84 + 0f84b63 commit 94f0a5b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions migrations/versions/0fbda260a023_add_user_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""add user_id
Revision ID: 0fbda260a023
Revises: 5659e13277b6
Create Date: 2024-11-08 12:49:18.796942
"""

import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = '0fbda260a023'
down_revision = '5659e13277b6'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('comment', sa.Column('user_id', sa.Integer(), nullable=True))


def downgrade():
op.drop_column('comment', 'user_id')
1 change: 1 addition & 0 deletions rating_api/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def search(self, query: str) -> bool:

class Comment(BaseDbModel):
uuid: Mapped[uuid.UUID] = mapped_column(UUID, primary_key=True, default=uuid.uuid4)
user_id: Mapped[int] = mapped_column(Integer, nullable=True)
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)
subject: Mapped[str] = mapped_column(String, nullable=False)
Expand Down
1 change: 1 addition & 0 deletions rating_api/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class CommentGet(Base):
uuid: UUID
user_id: int
create_ts: datetime.datetime
update_ts: datetime.datetime
subject: str
Expand Down

0 comments on commit 94f0a5b

Please sign in to comment.