@nextblock-cms/db 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
-- 02005: home "Live Demo" promo copy -- reset cadence "daily" -> "every 15 minutes".
|
|
2
|
+
--
|
|
3
|
+
-- cms.nextblock.dev now runs on Vercel Pro and its reset cron in vercel.json is
|
|
4
|
+
-- */15 * * * * (was 0 3 * * *, daily). The promo section on the EN ('home') and FR
|
|
5
|
+
-- ('accueil') home pages still advertises a daily reset; it already shipped through
|
|
6
|
+
-- 02000 (catch-up) / 02004 (baseline) and lives on real installs, so per the append-only
|
|
7
|
+
-- rule this is a forward-only data fix instead of an edit to those files.
|
|
8
|
+
--
|
|
9
|
+
-- Targets the promo by its nb-sandbox-promo sentinel + parent page (never blocks.id:
|
|
10
|
+
-- ids drift on every install) and rewrites only the six cadence phrases (EN + FR) with
|
|
11
|
+
-- replace(), leaving the rest of the block untouched. page_revisions rows carrying the
|
|
12
|
+
-- sentinel get the same rewrite so restoring a seeded revision cannot bring the "daily"
|
|
13
|
+
-- copy back. Idempotent: a second run matches zero rows (content already equals the
|
|
14
|
+
-- rewritten text). On the sandbox the promo is still stripped afterward by
|
|
15
|
+
-- removeSandboxPromoSections in the reset-sandbox route.
|
|
16
|
+
--
|
|
17
|
+
-- NOTE: keep the word "sandbox" OUT of this filename -- generate-sandbox-reset.ts
|
|
18
|
+
-- excludes any migration whose filename contains "sandbox" from the reset bundle.
|
|
19
|
+
|
|
20
|
+
CREATE OR REPLACE FUNCTION pg_temp.nb_promo_cadence_15min(src text)
|
|
21
|
+
RETURNS text
|
|
22
|
+
LANGUAGE sql
|
|
23
|
+
IMMUTABLE
|
|
24
|
+
AS $fn$
|
|
25
|
+
SELECT replace(replace(replace(replace(replace(replace(src,
|
|
26
|
+
'It resets daily, so explore',
|
|
27
|
+
'It resets every 15 minutes, so explore'),
|
|
28
|
+
'· Resets daily</p>',
|
|
29
|
+
'· Resets every 15 minutes</p>'),
|
|
30
|
+
'Wipes clean daily</strong>',
|
|
31
|
+
'Wipes clean every 15 minutes</strong>'),
|
|
32
|
+
'Il se réinitialise chaque jour :',
|
|
33
|
+
'Il se réinitialise toutes les 15 minutes :'),
|
|
34
|
+
'Réinitialisé chaque jour</p>',
|
|
35
|
+
'Réinitialisé toutes les 15 minutes</p>'),
|
|
36
|
+
'Remis à zéro chaque jour</strong>',
|
|
37
|
+
'Remis à zéro toutes les 15 minutes</strong>')
|
|
38
|
+
$fn$;
|
|
39
|
+
|
|
40
|
+
UPDATE public.blocks
|
|
41
|
+
SET content = pg_temp.nb_promo_cadence_15min(content::text)::jsonb,
|
|
42
|
+
updated_at = now()
|
|
43
|
+
WHERE block_type = 'section'
|
|
44
|
+
AND page_id IS NOT NULL
|
|
45
|
+
AND content::text LIKE '%nb-sandbox-promo%'
|
|
46
|
+
AND content::text <> pg_temp.nb_promo_cadence_15min(content::text);
|
|
47
|
+
|
|
48
|
+
UPDATE public.page_revisions
|
|
49
|
+
SET content = pg_temp.nb_promo_cadence_15min(content::text)::jsonb
|
|
50
|
+
WHERE content::text LIKE '%nb-sandbox-promo%'
|
|
51
|
+
AND content::text <> pg_temp.nb_promo_cadence_15min(content::text);
|
|
52
|
+
|
|
53
|
+
DROP FUNCTION IF EXISTS pg_temp.nb_promo_cadence_15min(text);
|