Skip to content

feat: add deleting_at column to workspaces #8333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix some merge woes
  • Loading branch information
sreya committed Jul 21, 2023
commit fd49248c0e69701f02c7ce54f5ca7944a455da88
1 change: 1 addition & 0 deletions coderd/database/dbfake/dbfake.go
Original file line number Diff line number Diff line change
Expand Up @@ -4997,6 +4997,7 @@ func (q *FakeQuerier) UpsertLastUpdateCheck(_ context.Context, data string) erro
defer q.mutex.Unlock()

q.lastUpdateCheck = []byte(data)
return nil
}

func (q *FakeQuerier) UpsertLogoURL(_ context.Context, data string) error {
Expand Down
13 changes: 12 additions & 1 deletion enterprise/coderd/schedule/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,19 @@ func (*EnterpriseTemplateScheduleStore) Set(ctx context.Context, db database.Sto
return xerrors.Errorf("update template schedule: %w", err)
}

// TODO: update all workspace max_deadlines to be within new bounds
// If we updated the locked_ttl we need to update all the workspaces deleting_at
// to ensure workspaces are being cleaned up correctly. Similarly if we are
// disabling it (by passing 0), then we want to delete nullify the deleting_at
// fields of all the template workspaces.
err = db.UpdateWorkspacesDeletingAtByTemplateID(ctx, database.UpdateWorkspacesDeletingAtByTemplateIDParams{
TemplateID: tpl.ID,
LockedTtlMs: opts.LockedTTL.Milliseconds(),
})
if err != nil {
return xerrors.Errorf("update deleting_at of all workspaces for new locked_ttl %q: %w", opts.LockedTTL, err)
}

// TODO: update all workspace max_deadlines to be within new bounds
template, err = db.GetTemplateByID(ctx, tpl.ID)
if err != nil {
return xerrors.Errorf("get updated template schedule: %w", err)
Expand Down
107 changes: 0 additions & 107 deletions enterprise/coderd/templateschedule.go

This file was deleted.

2 changes: 1 addition & 1 deletion enterprise/coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ func TestWorkspaceLock(t *testing.T) {
client, user = coderdenttest.New(t, &coderdenttest.Options{
Options: &coderdtest.Options{
IncludeProvisionerDaemon: true,
TemplateScheduleStore: &coderd.EnterpriseTemplateScheduleStore{},
TemplateScheduleStore: &schedule.EnterpriseTemplateScheduleStore{},
},
LicenseOptions: &coderdenttest.LicenseOptions{
Features: license.Features{
Expand Down