|
| 1 | +-- One-off backfill for editorial_posts rows that were posted to @ffmemes |
| 2 | +-- before the Comms agent had write access (see FFM-919 / FFM-918). |
| 3 | +-- |
| 4 | +-- Run once on prod against the ff database as a superuser (or as the app's |
| 5 | +-- writer role — comms_writer cannot upsert here because the rows pre-date |
| 6 | +-- the role's existence and we want this run audited). |
| 7 | +-- |
| 8 | +-- After both rows exist, the stats collector will start tracking |
| 9 | +-- views/forwards/reactions on its next run. |
| 10 | + |
| 11 | +\set ON_ERROR_STOP on |
| 12 | + |
| 13 | +BEGIN; |
| 14 | + |
| 15 | +-- May 3, 2026 — telegram_message_id=234 — activation-record post. |
| 16 | +INSERT INTO editorial_posts |
| 17 | + (channel, telegram_message_id, draft_hash, category, entity_id, |
| 18 | + topic_slug, text, has_media, validation_version, created_at) |
| 19 | +VALUES ( |
| 20 | + 'ffmemes', 234, |
| 21 | + '6a3e2f8c1b4d5a9e0712345678901234', |
| 22 | + 'C', 'cohort_week:2026-04-27', 'activation-record', |
| 23 | + E'<b>Интересное:</b> 77% новичков...\n\n↳ @ffmemesbot', |
| 24 | + true, 1, '2026-05-03 07:12:37' |
| 25 | +) |
| 26 | +ON CONFLICT (draft_hash) DO NOTHING; |
| 27 | + |
| 28 | +-- April 29, 2026 backfill — see FFM-918 for the post text + draft_hash. |
| 29 | +-- Replace the placeholders with the real values from the published archive |
| 30 | +-- (docs/comms/published/2026-04-29-new-user-activation-lift.md) before |
| 31 | +-- running. If the row already exists with a non-NULL telegram_message_id, |
| 32 | +-- the ON CONFLICT clause is a safe no-op. |
| 33 | + |
| 34 | +-- INSERT INTO editorial_posts |
| 35 | +-- (channel, telegram_message_id, draft_hash, category, entity_id, |
| 36 | +-- topic_slug, text, has_media, validation_version, created_at) |
| 37 | +-- VALUES ( |
| 38 | +-- 'ffmemes', <APR29_MSG_ID>, |
| 39 | +-- '<APR29_DRAFT_HASH>', |
| 40 | +-- '<CATEGORY>', '<ENTITY_ID>', '<TOPIC_SLUG>', |
| 41 | +-- E'<full post text>', |
| 42 | +-- true, 1, '2026-04-29 07:00:00' |
| 43 | +-- ) |
| 44 | +-- ON CONFLICT (draft_hash) DO NOTHING; |
| 45 | + |
| 46 | +-- Verify both rows landed. |
| 47 | +SELECT id, channel, telegram_message_id, category, entity_id, topic_slug, created_at |
| 48 | +FROM editorial_posts |
| 49 | +WHERE channel = 'ffmemes' |
| 50 | + AND created_at >= '2026-04-29' |
| 51 | +ORDER BY created_at; |
| 52 | + |
| 53 | +COMMIT; |
0 commit comments