Skip to content

Commit 53880ab

Browse files
committed
oh no I accidentally the coercion
1 parent 18e1593 commit 53880ab

File tree

5 files changed

+49
-15
lines changed

5 files changed

+49
-15
lines changed

coderd/database/migrations/000336_drop_workspace_app_stats_on_agent_delete.down.sql

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
3+
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
4+
--------------------+--------------------------+-----------+----------+-------------------------------------------------+----------+--------------+---------------------------------------------------------------------------------------------------------------------------------
5+
id | bigint | | not null | nextval('workspace_app_stats_id_seq'::regclass) | plain | | The ID of the record
6+
user_id | uuid | | not null | | plain | | The user who used the workspace app
7+
workspace_id | uuid | | not null | | plain | | The workspace that the workspace app was used in
8+
agent_id | uuid | | not null | | plain | | The workspace agent that was used
9+
access_method | text | | not null | | extended | | The method used to access the workspace app
10+
slug_or_port | text | | not null | | extended | | The slug or port used to to identify the app
11+
session_id | uuid | | not null | | plain | | The unique identifier for the session
12+
session_started_at | timestamp with time zone | | not null | | plain | | The time the session started
13+
session_ended_at | timestamp with time zone | | not null | | plain | | The time the session ended
14+
requests | integer | | not null | | plain | | The number of requests made during the session, a number larger than 1 indicates that multiple sessions were rolled up into one
15+
Indexes:
16+
"workspace_app_stats_pkey" PRIMARY KEY, btree (id)
17+
"workspace_app_stats_user_id_agent_id_session_id_key" UNIQUE CONSTRAINT, btree (user_id, agent_id, session_id)
18+
"workspace_app_stats_workspace_id_idx" btree (workspace_id)
19+
Foreign-key constraints:
20+
"workspace_app_stats_agent_id_fkey" FOREIGN KEY (agent_id) REFERENCES workspace_agents(id)
21+
"workspace_app_stats_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
22+
"workspace_app_stats_workspace_id_fkey" FOREIGN KEY (workspace_id) REFERENCES workspaces(id)
23+
Access method: heap
24+
*/
25+
26+
-- This migration alters workspace apps so that they cascade delete when
27+
-- the agent is deleted. This is to ensure that workspace app stats are
28+
-- removed when the agent is deleted, as they are no longer relevant.
29+
-- I want this, but in valid psql.
30+
-- ALTER TABLE workspace_app_stats
31+
-- ALTER CONSTRAINT workspace_app_stats_agent_id_fkey
32+
-- SET ON DELETE CASCADE;
33+
ALTER TABLE workspace_app_stats
34+
DROP CONSTRAINT workspace_app_stats_agent_id_fkey,
35+
ADD CONSTRAINT workspace_app_stats_agent_id_fkey
36+
FOREIGN KEY (agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;

site/src/modules/resources/AgentDevcontainerCard.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2+
import type { WorkspaceAgentDevcontainer } from "api/typesGenerated";
23
import {
34
MockWorkspace,
45
MockWorkspaceAgent,
56
MockWorkspaceAgentContainer,
67
MockWorkspaceAgentContainerPorts,
78
} from "testHelpers/entities";
89
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
9-
import type { WorkspaceAgentDevcontainer } from "api/typesGenerated";
1010

1111
const MockWorkspaceAgentDevcontainer: WorkspaceAgentDevcontainer = {
1212
id: "test-devcontainer-id",

site/src/modules/resources/AgentDevcontainerCard.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
import type { Interpolation, Theme } from "@emotion/react";
2+
import Skeleton from "@mui/material/Skeleton";
23
import type {
34
Template,
45
Workspace,
56
WorkspaceAgent,
67
WorkspaceAgentDevcontainer,
78
} from "api/typesGenerated";
8-
import { Stack } from "components/Stack/Stack";
99
import { Button } from "components/Button/Button";
1010
import { displayError } from "components/GlobalSnackbar/utils";
1111
import { Spinner } from "components/Spinner/Spinner";
12+
import { Stack } from "components/Stack/Stack";
1213
import {
1314
Tooltip,
1415
TooltipContent,
1516
TooltipProvider,
1617
TooltipTrigger,
1718
} from "components/Tooltip/Tooltip";
18-
import { ExternalLinkIcon, Container } from "lucide-react";
19+
import { useProxy } from "contexts/ProxyContext";
20+
import { Container, ExternalLinkIcon } from "lucide-react";
21+
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility";
22+
import { AppStatuses } from "pages/WorkspacePage/AppStatuses";
1923
import type { FC } from "react";
2024
import { useEffect, useState } from "react";
2125
import { portForwardURL } from "utils/portForward";
2226
import { AgentButton } from "./AgentButton";
27+
import { AgentLatency } from "./AgentLatency";
28+
import { Apps, organizeAgentApps } from "./AgentRow";
29+
import { SubAgentStatus } from "./AgentStatus";
30+
import { PortForwardButton } from "./PortForwardButton";
2331
import { AgentSSHButton } from "./SSHButton/SSHButton";
32+
import { SubAgentOutdatedTooltip } from "./SubAgentOutdatedTooltip";
2433
import { TerminalLink } from "./TerminalLink/TerminalLink";
2534
import { VSCodeDevContainerButton } from "./VSCodeDevContainerButton/VSCodeDevContainerButton";
26-
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility";
27-
import { useProxy } from "contexts/ProxyContext";
28-
import { PortForwardButton } from "./PortForwardButton";
29-
import { SubAgentStatus } from "./AgentStatus";
30-
import { AgentLatency } from "./AgentLatency";
31-
import Skeleton from "@mui/material/Skeleton";
32-
import { AppStatuses } from "pages/WorkspacePage/AppStatuses";
33-
import { SubAgentOutdatedTooltip } from "./SubAgentOutdatedTooltip";
34-
import { organizeAgentApps, Apps } from "./AgentRow";
3535

3636
type AgentDevcontainerCardProps = {
3737
parentAgent: WorkspaceAgent;

site/src/modules/resources/SubAgentOutdatedTooltip.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ import {
1313
HelpTooltipTrigger,
1414
} from "components/HelpTooltip/HelpTooltip";
1515
import { Stack } from "components/Stack/Stack";
16-
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
1716
import { RotateCcwIcon } from "lucide-react";
1817
import type { FC } from "react";
19-
import { agentVersionStatus } from "../../utils/workspace";
2018

2119
type SubAgentOutdatedTooltipProps = {
2220
devcontainer: WorkspaceAgentDevcontainer;
@@ -29,7 +27,7 @@ export const SubAgentOutdatedTooltip: FC<SubAgentOutdatedTooltipProps> = ({
2927
agent,
3028
onUpdate,
3129
}) => {
32-
if (!devcontainer.agent || devcontainer.agent.id != agent.id) {
30+
if (!devcontainer.agent || devcontainer.agent.id !== agent.id) {
3331
return null;
3432
}
3533
if (!devcontainer.dirty) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy