Files
coder/coderd/database/migrations/000592_remove_task_notifications.down.sql
T
Michael Suchacz f809776229 feat!: remove the task notification templates (#29084)
Removes the six Coder Tasks notification templates (their preferences
and inbox history go with them via cascade) and the
`preference_task_notification_alert_dismissed` user setting with its two
queries. The `task` value of `ai_seat_usage_reason` stays: seats
consumed through tasks remain consumed, and remapping their reason would
misstate billing history.

**Breaking change:** migration 000592 deletes data. The down migration
restores the template definitions, not the deleted preferences or
notification history.

**Review changes:** dropped the `ai_seat_state` remap and enum swap and
the migration unit test (both per review); moved the migration from
000591 to 000592 because main took 000591.

**Stack context:** Coder Tasks removal stack (CODAGT-642): #28743
frontend → #28788 CLI → #28789 API → #28790 provisioner → **#29084
notifications** → #29085 build reasons → #29086 tables → #28750
permissions. The last four PRs replace the single data-drop migration
that used to live in #28750; each carries one concern and its own
migration number.

> Created by Xum (AI agent) on behalf of @ibetitsmike.
2026-09-11 08:05:53 +00:00

66 lines
3.0 KiB
SQL

-- Restore task notification templates. Inbox notification history deleted
-- by the cascade is not recoverable.
INSERT INTO notification_templates (
id, name, title_template, body_template, actions, "group", method, kind, enabled_by_default
) VALUES (
'bd4b7168-d05e-4e19-ad0f-3593b77aa90f',
'Task Working',
E'Task ''{{.Labels.workspace}}'' is working',
E'The task ''{{.Labels.task}}'' transitioned to a working state.',
'[{"label": "View task", "url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}"}, {"label": "View workspace", "url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}"}]'::jsonb,
'Task Events',
NULL,
'system'::notification_template_kind,
false
), (
'd4a6271c-cced-4ed0-84ad-afd02a9c7799',
'Task Idle',
E'Task ''{{.Labels.workspace}}'' is idle',
E'The task ''{{.Labels.task}}'' is idle and ready for input.',
'[{"label": "View task", "url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}"}, {"label": "View workspace", "url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}"}]'::jsonb,
'Task Events',
NULL,
'system'::notification_template_kind,
false
), (
'8c5a4d12-9f7e-4b3a-a1c8-6e4f2d9b5a7c',
'Task Completed',
E'Task ''{{.Labels.workspace}}'' completed',
E'The task ''{{.Labels.task}}'' has completed successfully.',
'[{"label": "View task", "url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}"}, {"label": "View workspace", "url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}"}]'::jsonb,
'Task Events',
NULL,
'system'::notification_template_kind,
false
), (
'3b7e8f1a-4c2d-49a6-b5e9-7f3a1c8d6b4e',
'Task Failed',
E'Task ''{{.Labels.workspace}}'' failed',
E'The task ''{{.Labels.task}}'' has failed. Check the logs for more details.',
'[{"label": "View task", "url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}"}, {"label": "View workspace", "url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}"}]'::jsonb,
'Task Events',
NULL,
'system'::notification_template_kind,
false
), (
'2a74f3d3-ab09-4123-a4a5-ca238f4f65a1',
'Task Paused',
E'Task ''{{.Labels.task}}'' is paused',
E'The task ''{{.Labels.task}}'' was paused ({{.Labels.pause_reason}}).',
'[{"label": "View task", "url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.task_id}}"}, {"label": "View workspace", "url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}"}]'::jsonb,
'Task Events',
NULL,
'system'::notification_template_kind,
true
), (
'843ee9c3-a8fb-4846-afa9-977bec578649',
'Task Resumed',
E'Task ''{{.Labels.task}}'' has resumed',
E'The task ''{{.Labels.task}}'' has resumed.',
'[{"label": "View task", "url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.task_id}}"}, {"label": "View workspace", "url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}"}]'::jsonb,
'Task Events',
NULL,
'system'::notification_template_kind,
true
);