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

feat: add deleting_at column to workspaces #8333

merged 2 commits into from
Jul 21, 2023

Conversation

sreya
Copy link
Collaborator

@sreya sreya commented Jul 6, 2023

This PR adds a deleting_at column to the workspaces table. The deleting_at columns dictates when a workspace will be permanently deleted due to inactivity. Previously the value was computed but this made it difficult to filter by on the frontend.

@sreya sreya force-pushed the jon/deletedat branch 2 times, most recently from db90772 to 9d2d583 Compare July 14, 2023 03:27
@sreya sreya marked this pull request as ready for review July 19, 2023 23:44
@sreya sreya requested review from deansheather and coadler July 19, 2023 23:45
Comment on lines 788 to 800
template, err := tx.GetTemplateByID(ctx, workspace.TemplateID)
if err != nil {
return xerrors.Errorf("get template by id: %w", err)
}

err = tx.UpdateWorkspaceLockedDeletingAt(ctx, database.UpdateWorkspaceLockedDeletingAtParams{
ID: workspace.ID,
LockedAt: lockedAt,
LockedTtlMs: time.Duration(template.LockedTTL).Milliseconds(),
})
if err != nil {
return xerrors.Errorf("update workspace locked at: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of needing to do 2 queries here, could you join templates in the UpdateWorkspaceLockedDeletingAt query?

@sreya sreya merged commit b47d076 into main Jul 21, 2023
@sreya sreya deleted the jon/deletedat branch July 21, 2023 03:01
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants