Skip to content

Commit

Permalink
chore: use starts_with(path) for component_config_lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Oct 1, 2024
1 parent a81a7c3 commit aa3f89d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions schema/config.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ table "config_items" {
columns = [column.scraper_id]
where = "deleted_at IS NULL"
}
index "idx_config_items_path" {
columns = [column.path]
}
check "config_item_name_type_not_empty" {
expr = "LENGTH(name) > 0 AND LENGTH(type) > 0"
}
Expand Down
2 changes: 1 addition & 1 deletion views/005_component_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ BEGIN
WITH config_id_paths AS (
SELECT config_items.id
FROM config_items
WHERE path LIKE '%' || (SELECT config_id FROM components WHERE components.id = $1::UUID) || '%'
WHERE starts_with(path, (SELECT path FROM config_items WHERE id IN (SELECT config_id FROM components WHERE components.id = $1::UUID)))
)
SELECT components.id
FROM components
Expand Down

0 comments on commit aa3f89d

Please sign in to comment.