| 37483 |
amit |
1 |
-- Retire the SENDGRID sender label from dtr.mail_outbox.
|
|
|
2 |
--
|
|
|
3 |
-- SENDGRID never meant SendGrid. MailOutboxService.resolveSender() routed it to
|
|
|
4 |
-- the Google Workspace relay, same as RELAY -- which is why outbox mail kept
|
|
|
5 |
-- being delivered while code that injected a JavaMailSender directly failed
|
|
|
6 |
-- against the real (and dead) SendGrid bean.
|
|
|
7 |
--
|
|
|
8 |
-- Relabelling therefore changes no behaviour: these rows were already being sent
|
|
|
9 |
-- through the relay. It removes a label that named a provider we do not use.
|
|
|
10 |
--
|
|
|
11 |
-- APPLIED TO PRODUCTION (hadb1) 2026-08-31 18:10 IST.
|
|
|
12 |
-- before: SENDGRID=5956 RELAY=0 GOOGLE=4896 (total 10852)
|
|
|
13 |
-- after: SENDGRID=0 RELAY=5956 GOOGLE=4896 (total 10852)
|
|
|
14 |
-- backup: dtr.mail_outbox_sendgrid_backup_20260831_1810 (5956 rows)
|
|
|
15 |
--
|
|
|
16 |
-- The single PENDING row (id=26838) migrated cleanly and still routes to the
|
|
|
17 |
-- relay, exactly as it would have before.
|
|
|
18 |
|
|
|
19 |
-- 1. Back up what is about to change.
|
|
|
20 |
CREATE TABLE dtr.mail_outbox_sendgrid_backup_20260831_1810 AS
|
|
|
21 |
SELECT id, sender_type, status, created_at
|
|
|
22 |
FROM dtr.mail_outbox
|
|
|
23 |
WHERE sender_type = 'SENDGRID';
|
|
|
24 |
|
|
|
25 |
-- 2. Relabel.
|
|
|
26 |
UPDATE dtr.mail_outbox
|
|
|
27 |
SET sender_type = 'RELAY'
|
|
|
28 |
WHERE sender_type = 'SENDGRID';
|
|
|
29 |
|
|
|
30 |
-- 3. Verify: expect SENDGRID=0 and only GOOGLE,RELAY remaining.
|
|
|
31 |
SELECT sender_type, COUNT(*) FROM dtr.mail_outbox GROUP BY sender_type;
|
|
|
32 |
|
|
|
33 |
-- Rollback, should it ever be needed:
|
|
|
34 |
-- UPDATE dtr.mail_outbox o
|
|
|
35 |
-- JOIN dtr.mail_outbox_sendgrid_backup_20260831_1810 b ON b.id = o.id
|
|
|
36 |
-- SET o.sender_type = b.sender_type;
|