Skip to content

Commit

Permalink
chore: add missing indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Sep 30, 2024
1 parent e2aa2b7 commit ccb9b2a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions schema/agents.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ table "agents" {
columns = [column.name]
where = "deleted_at IS NULL"
}
index "idx_agents_name" {
columns = [column.name]
}

foreign_key "agents_created_by_fkey" {
columns = [column.created_by]
Expand Down
11 changes: 7 additions & 4 deletions schema/config.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,18 @@ table "config_changes" {
unique = true
columns = [column.config_id, column.external_change_id]
}

index "config_changes_change_type_idx" {
columns = [column.change_type]
}

index "config_changes_config_id_idx" {
columns = [column.config_id]
}

index "config_changes_config_id_change_type_idx" {
columns = [column.config_id, column.change_type]
}
index "config_changes_fingerprint_idx" {
columns = [column.fingerprint]
}

index "config_changes_is_pushed_idx" {
columns = [column.is_pushed]
where = "is_pushed IS FALSE"
Expand Down Expand Up @@ -390,6 +389,10 @@ table "config_items" {
index "idx_config_items_name" {
columns = [column.agent_id, column.name, column.type, column.config_class]
}
index "idx_config_items_scraper_id_deleted_at_null" {
columns = [column.scraper_id]
where = "deleted_at IS NULL"
}
check "config_item_name_type_not_empty" {
expr = "LENGTH(name) > 0 AND LENGTH(type) > 0"
}
Expand Down
3 changes: 3 additions & 0 deletions schema/playbooks.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,7 @@ table "playbook_run_actions" {
index "playbook_run_actions_status_time_idx" {
columns = [column.status, column.scheduled_time]
}
index "playbook_run_actions_playbook_run_id_idx" {
columns = [column.playbook_run_id]
}
}
6 changes: 6 additions & 0 deletions schema/system.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,10 @@ table "job_history" {
columns = [column.is_pushed]
where = "is_pushed IS FALSE AND status in ('FAILED', 'WARNING')"
}
index "job_history_resource_id_idx" {
columns = [column.resource_id]
}
index "job_history_status_idx" {
columns = [column.status]
}
}

0 comments on commit ccb9b2a

Please sign in to comment.