Files
database/migrations/archive/000.372.sql
T
Rikard BartholfandGitHub ddcbd0afb0 Archive old migrations (#426)
* Archive old migrations

* Fix invalid placement of migrations
2024-10-17 11:19:12 +02:00

57 lines
1.5 KiB
SQL

-- 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;