Skip to content

Commit

Permalink
add vulnerability ID index on certifyVuln (guacsec#2203)
Browse files Browse the repository at this point in the history
Signed-off-by: pxp928 <[email protected]>
  • Loading branch information
pxp928 authored Oct 18, 2024
1 parent 1a04f13 commit 95ebb06
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Create index "certifyvuln_vulnerability_id" to table: "certify_vulns"
CREATE INDEX "certifyvuln_vulnerability_id" ON "certify_vulns" ("vulnerability_id");
3 changes: 2 additions & 1 deletion pkg/assembler/backends/ent/migrate/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:3eRFoV2cM7hzSkmdDQ8HwhoF99Mp0L9r4o4UFWTzXe4=
h1:Ru5VFYpW/024wBxj0NuPPYqNe+IcDzjNmi/bBoLOQgw=
20240503123155_baseline.sql h1:oZtbKI8sJj3xQq7ibfvfhFoVl+Oa67CWP7DFrsVLVds=
20240626153721_ent_diff.sql h1:FvV1xELikdPbtJk7kxIZn9MhvVVoFLF/2/iT/wM5RkA=
20240702195630_ent_diff.sql h1:y8TgeUg35krYVORmC7cN4O96HqOc3mVO9IQ2lYzIzwg=
Expand All @@ -9,3 +9,4 @@ h1:3eRFoV2cM7hzSkmdDQ8HwhoF99Mp0L9r4o4UFWTzXe4=
20240826162616_ent_diff.sql h1:VyzOoAHvz3Ct8o/nva5qmyFzPOVmrJnXlrwpUCwoCHw=
20240918165345.sql h1:wpfJhr9rJSWWzbTA85rnLppDjGscJVaFpE1uZJXpScY=
20240919142722_ent_diff.sql h1:hcb42aHj5QUwbd7HXsUFnnAzHIckdXfGRDNYa24rns8=
20241017140224_ent_diff.sql h1:BrrQdJnjtZJ9FYOXc5PgEafQ6N3ADdydFPevjdyTqnU=
5 changes: 5 additions & 0 deletions pkg/assembler/backends/ent/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/assembler/backends/ent/schema/certifyvuln.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (CertifyVuln) Edges() []ent.Edge {
func (CertifyVuln) Indexes() []ent.Index {
return []ent.Index{
index.Fields("db_uri", "db_version", "scanner_uri", "scanner_version", "origin", "collector", "time_scanned", "document_ref").Edges("vulnerability", "package").Unique(),
index.Fields("package_id"), // speed up frequently run queries to check when CV nodes affect certain package IDs
index.Fields("package_id"), // speed up frequently run queries to check when CV nodes affect certain package IDs
index.Fields("vulnerability_id"), // speed up frequently run queries to check when CV nodes have a vulnerability
}
}

0 comments on commit 95ebb06

Please sign in to comment.