Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix list update query returning incorrect state on lists with no campaigns.

Kailash Nadhb46e0d6947a8
diff --git a/queries/lists.sql b/queries/lists.sql
index 740986e0..751ff811 100644
--- a/queries/lists.sql
+++ b/queries/lists.sql
@@ -67,8 +67,11 @@ WITH l AS (
updated_at=NOW()
WHERE id = $1
RETURNING id, name
+),
+c AS (
+ UPDATE campaign_lists SET list_name = l.name FROM l WHERE campaign_lists.list_id = l.id RETURNING 1
)
-UPDATE campaign_lists SET list_name = l.name FROM l WHERE campaign_lists.list_id = l.id;
+SELECT COUNT(*) FROM l, c;
-- name: update-lists-date
UPDATE lists SET updated_at=NOW() WHERE id = ANY($1);