diff --git a/schema/agents.hcl b/schema/agents.hcl index ff2f3257..727f1e2f 100644 --- a/schema/agents.hcl +++ b/schema/agents.hcl @@ -68,6 +68,17 @@ table "agents" { default = sql("now()") } + column "cleanup" { + null = false + type = boolean + default = false + } + + column "deleted_at" { + null = true + type = timestamptz + } + primary_key { columns = [column.id] } diff --git a/views/022_agents.sql b/views/022_agents.sql index bcbe98ea..179c45c8 100644 --- a/views/022_agents.sql +++ b/views/022_agents.sql @@ -1,3 +1,5 @@ +DROP VIEW IF EXISTS agents_summary; + CREATE OR REPLACE VIEW agents_summary AS SELECT agents.*, @@ -42,4 +44,6 @@ FROM playbook_runs GROUP BY agent_id - ) AS playbook_runs ON playbook_runs.agent_id = agents.id \ No newline at end of file + ) AS playbook_runs ON playbook_runs.agent_id = agents.id +WHERE + deleted_at IS NULL; \ No newline at end of file