From d231e312ec28d69fed65ae275687264f653c6b42 Mon Sep 17 00:00:00 2001 From: Fredrik Ringqvist <35255659+fredrikphotowall@users.noreply.github.com> Date: Tue, 27 Sep 2022 13:25:15 +0200 Subject: [PATCH] Copy magazine articles for Estonia and Luxembourg (#292) --- migrations/000.390.sql | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 migrations/000.390.sql diff --git a/migrations/000.390.sql b/migrations/000.390.sql new file mode 100644 index 0000000..55b6a9d --- /dev/null +++ b/migrations/000.390.sql @@ -0,0 +1,53 @@ +-- Copy magazine articles to Estonia and Luxembourg + +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/', '/ee/'), + (select id from market_locales where name = 'Estonia (English)' limit 1) +FROM article_content ac +WHERE ac.market_locale_id = (select id from market_locales where name = 'International' limit 1); + +-- Replace URLs +UPDATE article_content + SET body = regexp_replace(body, 'www.photowall.global/', 'www.photowall.com/ee/', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Estonia (English)'); + +UPDATE article_content + SET body = regexp_replace(body, '\.\./\.\./\.\./int', 'https://www.photowall.com/ee', 'g') +WHERE market_locale_id = (select id from market_locales where name = 'Estonia (English)'); + + +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, '^/ca-fr/', '/lu-fr/'), + (select id from market_locales where name = 'Luxembourg (French)' limit 1) +FROM article_content ac +WHERE ac.market_locale_id = (select id from market_locales where name = 'Canada (French)' limit 1); + + +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, '^/', '/lu-de/'), + (select id from market_locales where name = 'Luxembourg (German)' limit 1) +FROM article_content ac +WHERE ac.market_locale_id = (select id from market_locales where name = 'Germany' limit 1); + + +UPDATE article_content SET body = REGEXP_REPLACE(body, 'www.photowall.de', 'www.photowall.com/lu-de', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Luxembourg (German)' limit 1); + +UPDATE article_content SET body = REGEXP_REPLACE(body, 'www.photowall.com/ca-fr', 'www.photowall.com/lu-fr', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Luxembourg (French)' limit 1); + +UPDATE article_content SET body = regexp_replace(body, '\.\./\.\./\.\./ca-fr', 'https://www.photowall.com/lu-fr', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Luxembourg (French)' limit 1); + +UPDATE article_content SET body = regexp_replace(body, '\.\./\.\./\.\.', 'https://www.photowall.com/lu-de', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Luxembourg (German)' limit 1); +