From eaaca05f36ae1ab85c7d65fd60b92b69e7a30588 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 8 Nov 2022 23:35:57 +0530 Subject: [PATCH] Fix archive template selection in campaign creation query. --- queries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries.sql b/queries.sql index 8b20a2f..6300079 100644 --- a/queries.sql +++ b/queries.sql @@ -474,7 +474,7 @@ counts AS ( ), camp AS ( INSERT INTO campaigns (uuid, type, name, subject, from_email, body, altbody, content_type, send_at, headers, tags, messenger, template_id, to_send, max_subscriber_id, archive, archive_template_id, archive_meta) - SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, (SELECT id FROM tpl), (SELECT to_send FROM counts), (SELECT max_sub_id FROM counts), $15, $16, $17 + SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, (SELECT id FROM tpl), (SELECT to_send FROM counts), (SELECT max_sub_id FROM counts), $15, (CASE WHEN $16 = 0 THEN (SELECT id FROM tpl) ELSE $16 END), $17 RETURNING id ) INSERT INTO campaign_lists (campaign_id, list_id, list_name)