@@ -53,10 +53,10 @@ class ScanSession(Base):
5353 __tablename__ = "scan_sessions"
5454
5555 id : Mapped [str ] = mapped_column (String (32 ), primary_key = True , default = _uuid )
56- project_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("projects.id" ), nullable = True )
56+ project_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("projects.id" ), nullable = True , index = True )
5757 target : Mapped [str ] = mapped_column (String (1024 ), nullable = False )
5858 target_type : Mapped [str ] = mapped_column (String (50 ), nullable = False )
59- status : Mapped [str ] = mapped_column (String (20 ), default = ScanStatus .PENDING .value )
59+ status : Mapped [str ] = mapped_column (String (20 ), default = ScanStatus .PENDING .value , index = True )
6060 profile : Mapped [str ] = mapped_column (String (50 ), default = "auto" )
6161 progress : Mapped [float ] = mapped_column (Float , default = 0.0 )
6262 current_step : Mapped [str | None ] = mapped_column (String (255 ), nullable = True )
@@ -76,7 +76,7 @@ class Asset(Base):
7676 __tablename__ = "assets"
7777
7878 id : Mapped [str ] = mapped_column (String (32 ), primary_key = True , default = _uuid )
79- scan_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("scan_sessions.id" ), nullable = False )
79+ scan_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("scan_sessions.id" ), nullable = False , index = True )
8080 name : Mapped [str ] = mapped_column (String (1024 ), nullable = False )
8181 asset_type : Mapped [str ] = mapped_column (String (50 ), nullable = False )
8282 value : Mapped [str | None ] = mapped_column (Text , nullable = True )
@@ -91,8 +91,8 @@ class Finding(Base):
9191 __tablename__ = "findings"
9292
9393 id : Mapped [str ] = mapped_column (String (32 ), primary_key = True , default = _uuid )
94- scan_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("scan_sessions.id" ), nullable = False )
95- asset_id : Mapped [str | None ] = mapped_column (String (32 ), ForeignKey ("assets.id" ), nullable = True )
94+ scan_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("scan_sessions.id" ), nullable = False , index = True )
95+ asset_id : Mapped [str | None ] = mapped_column (String (32 ), ForeignKey ("assets.id" ), nullable = True , index = True )
9696 title : Mapped [str ] = mapped_column (String (255 ), nullable = False )
9797 description : Mapped [str | None ] = mapped_column (Text , nullable = True )
9898 severity : Mapped [str ] = mapped_column (String (20 ), default = Severity .MEDIUM .value )
@@ -118,7 +118,7 @@ class AgentResult(Base):
118118 __tablename__ = "agent_results"
119119
120120 id : Mapped [str ] = mapped_column (String (32 ), primary_key = True , default = _uuid )
121- scan_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("scan_sessions.id" ), nullable = False )
121+ scan_id : Mapped [str ] = mapped_column (String (32 ), ForeignKey ("scan_sessions.id" ), nullable = False , index = True )
122122 agent_name : Mapped [str ] = mapped_column (String (100 ), nullable = False )
123123 status : Mapped [str ] = mapped_column (String (20 ), default = AgentStatus .IDLE .value )
124124 started_at : Mapped [datetime | None ] = mapped_column (DateTime , nullable = True )
0 commit comments