Skip to content

Commit

Permalink
fix: sqlalchemy default values now callable (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
xerbalind authored May 5, 2024
1 parent 73e591a commit 66c58cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Project(Base):
deadline: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False)
publish_date: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=True, default=datetime.now()
DateTime(timezone=True), nullable=True, default=datetime.now
)
name: Mapped[str] = mapped_column(nullable=False)
subject_id: Mapped[int] = mapped_column(
Expand Down
4 changes: 2 additions & 2 deletions backend/src/subject/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Subject(Base):

id: Mapped[int] = mapped_column(primary_key=True)
academic_year: Mapped[int] = mapped_column(
nullable=False, default=datetime.now().year)
uuid: Mapped[str] = mapped_column(default=str(uuid4()))
nullable=False, default=lambda _: datetime.now().year)
uuid: Mapped[str] = mapped_column(default=lambda _: str(uuid4()))
email: Mapped[str] = mapped_column(nullable=True)
name: Mapped[str]

0 comments on commit 66c58cd

Please sign in to comment.