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 18cca74
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ redis==5.0.8
requests==2.32.2
rq==1.16.2
sniffio==1.3.1
sqlmodel==0.0.11
sqlmodel==0.0.22
starlette==0.38.6
typed-config==2.0.3
types-requests==2.32.0.20240914
Expand Down
5 changes: 1 addition & 4 deletions src/models/jobagent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from sqlalchemy import Column, ForeignKey
from sqlmodel import SQLModel, Field, Relationship
from typing import Union, TYPE_CHECKING

Expand All @@ -13,9 +12,7 @@ class JobAgent(SQLModel, table=True):
id: Union[int, None] = Field(default=None, primary_key=True)
task_in_progress: int

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

agent_id: int = Field(foreign_key="agentgroup.id")
Expand Down
5 changes: 1 addition & 4 deletions src/models/match.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from sqlalchemy import ForeignKey
from sqlmodel import SQLModel, Field, ARRAY, String, Column, JSON, Relationship
from typing import List, Union, Dict, Any

Expand All @@ -16,7 +15,5 @@ class Match(SQLModel, table=True):
# A list of yara rules matched to this file
matches: List[str] = Field(sa_column=Column(ARRAY(String)))

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

0 comments on commit 18cca74

Please sign in to comment.