Skip to content

Commit ce04f6c

Browse files
authored
fix(coderd): remove deprecated AITaskSidebarApp column (coder#20680)
This column was no longer used in `v2.28` and the codersdk field deprecated. Both can now be dropped in `v2.29`. Closes coder/internal#974
1 parent 32e504c commit ce04f6c

24 files changed

Lines changed: 127 additions & 108 deletions

coderd/apidoc/docs.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,7 +2161,7 @@ func (s *MethodTestSuite) TestWorkspace() {
21612161
})
21622162
res := testutil.Fake(s.T(), faker, database.WorkspaceResource{JobID: b.JobID})
21632163
agt := testutil.Fake(s.T(), faker, database.WorkspaceAgent{ResourceID: res.ID})
2164-
app := testutil.Fake(s.T(), faker, database.WorkspaceApp{AgentID: agt.ID})
2164+
_ = testutil.Fake(s.T(), faker, database.WorkspaceApp{AgentID: agt.ID})
21652165

21662166
dbm.EXPECT().GetWorkspaceByID(gomock.Any(), w.ID).Return(w, nil).AnyTimes()
21672167
dbm.EXPECT().GetWorkspaceBuildByID(gomock.Any(), b.ID).Return(b, nil).AnyTimes()
@@ -2170,7 +2170,6 @@ func (s *MethodTestSuite) TestWorkspace() {
21702170
ID: b.ID,
21712171
HasAITask: sql.NullBool{Bool: true, Valid: true},
21722172
HasExternalAgent: sql.NullBool{Bool: true, Valid: true},
2173-
SidebarAppID: uuid.NullUUID{UUID: app.ID, Valid: true},
21742173
UpdatedAt: b.UpdatedAt,
21752174
}).Asserts(w, policy.ActionUpdate)
21762175
}))

coderd/database/dbfake/dbfake.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ func (b WorkspaceBuildBuilder) doInTX() WorkspaceResponse {
189189
Bool: true,
190190
Valid: true,
191191
}
192-
b.seed.AITaskSidebarAppID = uuid.NullUUID{UUID: b.taskAppID, Valid: true}
193192
}
194193

195194
resp := WorkspaceResponse{

coderd/database/dbgen/dbgen.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ func WorkspaceBuild(t testing.TB, db database.Store, orig database.WorkspaceBuil
451451
buildID := takeFirst(orig.ID, uuid.New())
452452
jobID := takeFirst(orig.JobID, uuid.New())
453453
hasAITask := takeFirst(orig.HasAITask, sql.NullBool{})
454-
sidebarAppID := takeFirst(orig.AITaskSidebarAppID, uuid.NullUUID{})
455454
hasExternalAgent := takeFirst(orig.HasExternalAgent, sql.NullBool{})
456455
var build database.WorkspaceBuild
457456
err := db.InTx(func(db database.Store) error {
@@ -491,7 +490,6 @@ func WorkspaceBuild(t testing.TB, db database.Store, orig database.WorkspaceBuil
491490
ID: buildID,
492491
HasAITask: hasAITask,
493492
HasExternalAgent: hasExternalAgent,
494-
SidebarAppID: sidebarAppID,
495493
UpdatedAt: dbtime.Now(),
496494
}))
497495
}

coderd/database/dump.sql

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/foreign_key_constraint.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ALTER TABLE workspace_builds ADD COLUMN ai_task_sidebar_app_id UUID;
2+
ALTER TABLE workspace_builds ADD CONSTRAINT workspace_builds_ai_task_sidebar_app_id_fkey FOREIGN KEY (ai_task_sidebar_app_id) REFERENCES workspace_apps(id);
3+
4+
DROP VIEW workspace_build_with_user;
5+
-- Restore view.
6+
CREATE VIEW workspace_build_with_user AS
7+
SELECT
8+
workspace_builds.id,
9+
workspace_builds.created_at,
10+
workspace_builds.updated_at,
11+
workspace_builds.workspace_id,
12+
workspace_builds.template_version_id,
13+
workspace_builds.build_number,
14+
workspace_builds.transition,
15+
workspace_builds.initiator_id,
16+
workspace_builds.provisioner_state,
17+
workspace_builds.job_id,
18+
workspace_builds.deadline,
19+
workspace_builds.reason,
20+
workspace_builds.daily_cost,
21+
workspace_builds.max_deadline,
22+
workspace_builds.template_version_preset_id,
23+
workspace_builds.has_ai_task,
24+
workspace_builds.ai_task_sidebar_app_id,
25+
workspace_builds.has_external_agent,
26+
COALESCE(
27+
visible_users.avatar_url,
28+
'' :: text
29+
) AS initiator_by_avatar_url,
30+
COALESCE(
31+
visible_users.username,
32+
'' :: text
33+
) AS initiator_by_username,
34+
COALESCE(visible_users.name, '' :: text) AS initiator_by_name
35+
FROM
36+
(
37+
workspace_builds
38+
LEFT JOIN visible_users ON (
39+
(
40+
workspace_builds.initiator_id = visible_users.id
41+
)
42+
)
43+
);
44+
45+
COMMENT ON VIEW workspace_build_with_user IS 'Joins in the username + avatar url of the initiated by user.';
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
-- We're dropping the ai_task_sidebar_app_id column.
2+
DROP VIEW workspace_build_with_user;
3+
CREATE VIEW workspace_build_with_user AS
4+
SELECT
5+
workspace_builds.id,
6+
workspace_builds.created_at,
7+
workspace_builds.updated_at,
8+
workspace_builds.workspace_id,
9+
workspace_builds.template_version_id,
10+
workspace_builds.build_number,
11+
workspace_builds.transition,
12+
workspace_builds.initiator_id,
13+
workspace_builds.provisioner_state,
14+
workspace_builds.job_id,
15+
workspace_builds.deadline,
16+
workspace_builds.reason,
17+
workspace_builds.daily_cost,
18+
workspace_builds.max_deadline,
19+
workspace_builds.template_version_preset_id,
20+
workspace_builds.has_ai_task,
21+
workspace_builds.has_external_agent,
22+
COALESCE(
23+
visible_users.avatar_url,
24+
'' :: text
25+
) AS initiator_by_avatar_url,
26+
COALESCE(
27+
visible_users.username,
28+
'' :: text
29+
) AS initiator_by_username,
30+
COALESCE(visible_users.name, '' :: text) AS initiator_by_name
31+
FROM
32+
(
33+
workspace_builds
34+
LEFT JOIN visible_users ON (
35+
(
36+
workspace_builds.initiator_id = visible_users.id
37+
)
38+
)
39+
);
40+
41+
COMMENT ON VIEW workspace_build_with_user IS 'Joins in the username + avatar url of the initiated by user.';
42+
43+
ALTER TABLE workspace_builds DROP COLUMN ai_task_sidebar_app_id;

coderd/database/models.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)