diff --git a/migrations/000.382.sql b/migrations/000.382.sql new file mode 100644 index 0000000..7e0f562 --- /dev/null +++ b/migrations/000.382.sql @@ -0,0 +1,95 @@ +-- Copy magazine articles to switzerland + +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, '^/it/', '/ch-it/'), + (select id from market_locales where name = 'Switzerland (Italian)' limit 1) +FROM article_content ac +WHERE ac.market_locale_id = (select id from market_locales where name = 'Italy' limit 1); + +-- I copy from Canadian French (19 articles), instead of France French (222 articles). +-- Better quality (less chance of wrong currency, links, etc), but worse quantity +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/', '/ch-fr/'), + (select id from market_locales where name = 'Switzerland (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, '^/', '/ch-de/'), + (select id from market_locales where name = 'Switzerland (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/ch-de', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Switzerland (German)' limit 1); + +UPDATE article_content SET body = REGEXP_REPLACE(body, 'www.photowall.com/it', 'www.photowall.com/ch-it', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Switzerland (Italian)' limit 1); + +UPDATE article_content SET body = REGEXP_REPLACE(body, 'www.photowall.com/ca-fr', 'www.photowall.com/ch-fr', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Switzerland (French)' limit 1); + +UPDATE article_content SET body = regexp_replace(body, '\.\./\.\./\.\./it', 'https://www.photowall.com/ch-it', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Switzerland (Italian)' limit 1); + +UPDATE article_content SET body = regexp_replace(body, '\.\./\.\./\.\./ca-fr', 'https://www.photowall.com/ch-fr', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Switzerland (French)' limit 1); + +UPDATE article_content SET body = regexp_replace(body, '\.\./\.\./\.\.', 'https://www.photowall.com/ch-de', 'g') + WHERE market_locale_id = (select id from market_locales where name = 'Switzerland (German)' limit 1); + + +-- Things like "Die Standardtapeten kosten €39 pro Quadratmeter" are not converted unfortuately