Skip to content

Commit

Permalink
Make fields nullable again
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code committed Oct 27, 2024
1 parent 2713b7f commit 79a4977
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/models/jobagent.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sqlalchemy import Column, ForeignKey
from sqlmodel import SQLModel, Field, Relationship
from sqlalchemy import ForeignKey
from sqlmodel import SQLModel, Field, Relationship, Column
from typing import Union, TYPE_CHECKING

if TYPE_CHECKING:
Expand All @@ -14,7 +14,9 @@ class JobAgent(SQLModel, table=True):
task_in_progress: int

job_id: int = Field(
sa_column=Column(ForeignKey("job.internal_id", ondelete="CASCADE"))
sa_column=Column(
ForeignKey("job.internal_id", ondelete="CASCADE"), nullable=False
),
)
job: "Job" = Relationship(back_populates="agents")

Expand Down
4 changes: 3 additions & 1 deletion src/models/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Match(SQLModel, table=True):
matches: List[str] = Field(sa_column=Column(ARRAY(String)))

job_id: int = Field(
sa_column=Column(ForeignKey("job.internal_id", ondelete="CASCADE"))
sa_column=Column(
ForeignKey("job.internal_id", ondelete="CASCADE"), nullable=False
)
)
job: Job = Relationship(back_populates="matches")

0 comments on commit 79a4977

Please sign in to comment.