From 8eb6d02c89e721261c4aa58aff208c4a4ef32121 Mon Sep 17 00:00:00 2001 From: fredrikphotowall <35255659+fredrikphotowall@users.noreply.github.com> Date: Wed, 24 Mar 2021 14:36:49 +0100 Subject: [PATCH] P5-6976 Add Canadian collections_texts, designer_texts, categorydata (#204) --- migrations/000.320.sql | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 migrations/000.320.sql diff --git a/migrations/000.320.sql b/migrations/000.320.sql new file mode 100644 index 0000000..249303c --- /dev/null +++ b/migrations/000.320.sql @@ -0,0 +1,46 @@ +-- P5-6976 Add Canadian collections_texts, designer_texts, categorydata + +INSERT INTO collections_texts + (locale_id, collection_id, meta_title, meta_description, title, description, slug) + SELECT + (SELECT id FROM locales WHERE value = 'fr_CA'), + collection_id, meta_title, meta_description, title, description, slug + FROM collections_texts + WHERE locale_id = (SELECT id FROM locales WHERE value = 'fr_FR') +ON CONFLICT DO NOTHING; + +INSERT INTO collections_texts + (locale_id, collection_id, meta_title, meta_description, title, description, slug) + SELECT + (SELECT id FROM locales WHERE value = 'en_CA'), + collection_id, meta_title, meta_description, title, description, slug + FROM collections_texts + WHERE locale_id = (SELECT id FROM locales WHERE value = 'en_US') +ON CONFLICT DO NOTHING; + +INSERT INTO designer_texts (locale_id, designerid, header, description) + SELECT + (SELECT id FROM locales WHERE value = 'fr_CA'), + designerid, header, description + FROM designer_texts + WHERE locale_id = (SELECT id FROM locales WHERE value = 'fr_FR') +ON CONFLICT DO NOTHING; + +INSERT INTO designer_texts (locale_id, designerid, header, description) + SELECT + (SELECT id FROM locales WHERE value = 'en_CA'), + designerid, header, description + FROM designer_texts + WHERE locale_id = (SELECT id FROM locales WHERE value = 'en_US') +ON CONFLICT DO NOTHING; + +INSERT INTO categorydata (locale_id, category_id, datakey_id, text) SELECT + (SELECT id FROM locales WHERE value = 'fr_CA'), category_id, datakey_id, text + FROM categorydata WHERE locale_id = (SELECT id FROM locales WHERE value = 'fr_FR') + ON CONFLICT DO NOTHING; + +INSERT INTO categorydata (locale_id, category_id, datakey_id, text) SELECT + (SELECT id FROM locales WHERE value = 'en_CA'), category_id, datakey_id, text + FROM categorydata WHERE locale_id = (SELECT id FROM locales WHERE value = 'en_US') + ON CONFLICT DO NOTHING; +