diff --git a/src/models/jobagent.py b/src/models/jobagent.py index a8041ea3..e30f4cf9 100644 --- a/src/models/jobagent.py +++ b/src/models/jobagent.py @@ -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: @@ -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") diff --git a/src/models/match.py b/src/models/match.py index 7e089688..fde9af51 100644 --- a/src/models/match.py +++ b/src/models/match.py @@ -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")