Skip to content

Commit

Permalink
chore: add agent_id to checks, components and config
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed May 15, 2023
1 parent 2a39050 commit fb25486
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
20 changes: 20 additions & 0 deletions schema/checks.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ table "check_statuses" {
null = false
type = uuid
}
column "agent_id" {
null = true
type = uuid
}
column "details" {
null = true
type = jsonb
Expand Down Expand Up @@ -115,6 +119,12 @@ table "check_statuses" {
on_update = NO_ACTION
on_delete = CASCADE
}
foreign_key "check_statuses_agent_id_fkey" {
columns = [column.agent_id]
ref_columns = [table.agents.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}
index "check_statuses_time_brin_idx" {
type = BRIN
columns = [column.time]
Expand All @@ -132,6 +142,10 @@ table "checks" {
null = false
type = uuid
}
column "agent_id" {
null = true
type = uuid
}
column "type" {
null = false
type = text
Expand Down Expand Up @@ -213,6 +227,12 @@ table "checks" {
on_update = NO_ACTION
on_delete = CASCADE
}
foreign_key "checks_agent_id_fkey" {
columns = [column.agent_id]
ref_columns = [table.agents.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}
index "checks_canary_id_type_name_key" {
unique = true
columns = [column.canary_id, column.type, column.name]
Expand Down
23 changes: 22 additions & 1 deletion schema/components.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

table "topologies" {
schema = schema.public
column "id" {
Expand Down Expand Up @@ -92,6 +91,11 @@ table "component_relationships" {
null = true
type = text
}
column "agent_id" {
null = true
type = uuid
}

foreign_key "component_relationships_component_id_fkey" {
columns = [column.component_id]
ref_columns = [table.components.column.id]
Expand All @@ -104,6 +108,13 @@ table "component_relationships" {
on_update = NO_ACTION
on_delete = NO_ACTION
}
foreign_key "component_relationships_agent_id_fkey" {
columns = [column.agent_id]
ref_columns = [table.agents.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}

index "component_relationships_component_id_relationship_id_select_key" {
unique = true
columns = [column.component_id, column.relationship_id, column.selector_id]
Expand Down Expand Up @@ -365,6 +376,10 @@ table "config_component_relationships" {
null = false
type = uuid
}
column "agent_id" {
null = true
type = uuid
}
column "created_at" {
null = false
type = timestamptz
Expand Down Expand Up @@ -395,6 +410,12 @@ table "config_component_relationships" {
on_update = NO_ACTION
on_delete = NO_ACTION
}
foreign_key "config_component_relationships_agent_id_fkey" {
columns = [column.agent_id]
ref_columns = [table.agents.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}
index "config_component_relationships_component_id_config_id_key" {
unique = true
columns = [column.component_id, column.config_id]
Expand Down
20 changes: 20 additions & 0 deletions schema/config.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ table "config_analysis" {
null = false
type = uuid
}
column "agent_id" {
null = true
type = uuid
}
column "created_by" {
null = true
type = uuid
Expand Down Expand Up @@ -69,6 +73,12 @@ table "config_analysis" {
on_update = NO_ACTION
on_delete = NO_ACTION
}
foreign_key "config_analysis_agent_id_fkey" {
columns = [column.agent_id]
ref_columns = [table.agents.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}
}

table "config_changes" {
Expand All @@ -82,6 +92,10 @@ table "config_changes" {
null = false
type = uuid
}
column "agent_id" {
null = true
type = uuid
}
column "external_change_id" {
null = true
type = text
Expand Down Expand Up @@ -136,6 +150,12 @@ table "config_changes" {
on_update = NO_ACTION
on_delete = NO_ACTION
}
foreign_key "config_changes_agent_id_fkey" {
columns = [column.agent_id]
ref_columns = [table.agents.column.id]
on_update = NO_ACTION
on_delete = NO_ACTION
}
index "config_changes_config_id_external_change_id_key" {
unique = true
columns = [column.config_id, column.external_change_id]
Expand Down

0 comments on commit fb25486

Please sign in to comment.