From 40cd3405329e3da1f6a9d304bb9a8465c9137bab Mon Sep 17 00:00:00 2001 From: Rikard Bartholf Date: Tue, 10 May 2022 16:21:57 +0200 Subject: [PATCH] Copy articels to new markets (#273) * Copy articels to new markets * Cleanup * Translate more URLs * Cleanup --- migrations/000.372.sql | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 migrations/000.372.sql diff --git a/migrations/000.372.sql b/migrations/000.372.sql new file mode 100644 index 0000000..112ae07 --- /dev/null +++ b/migrations/000.372.sql @@ -0,0 +1,56 @@ +-- Copy global articles to new markets + +INSERT INTO article_content ( + article_id, + title, + preamble, + body, + body_saved, + meta_title, + meta_description, + slug, + market_locale_id +) +SELECT article_id, + title, + preamble, + body, + now(), + meta_title, + meta_description, + REGEXP_REPLACE(slug, '^/int/', m.market_name), + m.market_locale_id + FROM article_content ac + CROSS JOIN ( + SELECT 23 AS market_locale_id, '/ie/' AS market_name + UNION + SELECT 24, '/sg/' + UNION + SELECT 25, '/au/' + ) m + WHERE ac.market_locale_id = 6; + +-- Replace URLs +UPDATE article_content + SET body = regexp_replace(body, 'www.photowall.global/', 'www.photowall.com/ie/', 'g') + WHERE market_locale_id = 23; + +UPDATE article_content + SET body = regexp_replace(body, 'www.photowall.global/', 'www.photowall.com/sg/', 'g') + WHERE market_locale_id = 24; + +UPDATE article_content + SET body = regexp_replace(body, 'www.photowall.global/', 'www.photowall.com/au/', 'g') + WHERE market_locale_id = 25; + +UPDATE article_content + SET body = regexp_replace(body, '\.\./\.\./\.\./int', 'https://www.photowall.com/ie', 'g') + WHERE market_locale_id = 23; + +UPDATE article_content + SET body = regexp_replace(body, '\.\./\.\./\.\./int', 'https://www.photowall.com/sg', 'g') + WHERE market_locale_id = 24; + +UPDATE article_content + SET body = regexp_replace(body, '\.\./\.\./\.\./int', 'https://www.photowall.com/au', 'g') + WHERE market_locale_id = 25;