feat: add parent_id column to workspace_agents table (#17758)

Adds a new nullable column `parent_id` to `workspace_agents` table. This
lays the groundwork for having child agents.
This commit is contained in:
Danielle Maywood
2025-05-13 00:01:31 +01:00
committed by GitHub
parent 398b999d8f
commit 0b5f27f566
25 changed files with 278 additions and 26 deletions
@@ -2085,6 +2085,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
agentID := uuid.New()
dbAgent, err := db.InsertWorkspaceAgent(ctx, database.InsertWorkspaceAgentParams{
ID: agentID,
ParentID: uuid.NullUUID{},
CreatedAt: dbtime.Now(),
UpdatedAt: dbtime.Now(),
ResourceID: resource.ID,
@@ -2158,6 +2158,7 @@ func TestInsertWorkspaceResource(t *testing.T) {
require.NoError(t, err)
require.Len(t, agents, 1)
agent := agents[0]
require.Equal(t, uuid.NullUUID{}, agent.ParentID)
require.Equal(t, "amd64", agent.Architecture)
require.Equal(t, "linux", agent.OperatingSystem)
want, err := json.Marshal(map[string]string{