feat: add delete tenant command

This commit is contained in:
2024-02-27 15:30:21 +01:00
parent df1a586d38
commit 8438c4bc1a
5 changed files with 88 additions and 5 deletions

View File

@ -230,8 +230,8 @@ func (r *AgentRepository) UpdateSpec(ctx context.Context, agentID datastore.Agen
now := time.Now().UTC()
query := `
INSERT INTO specs (agent_id, name, revision, data, created_at, updated_at)
VALUES($1, $2, $3, $4, $5, $5)
INSERT INTO specs (agent_id, name, revision, data, created_at, updated_at, tenant_id)
VALUES($1, $2, $3, $4, $5, $5, ( SELECT tenant_id FROM agents WHERE id = $1 ))
ON CONFLICT (agent_id, name) DO UPDATE SET
data = $4, updated_at = $5, revision = specs.revision + 1
WHERE revision = $3