Archive old migrations (#426)

* Archive old migrations

* Fix invalid placement of migrations
This commit is contained in:
Rikard Bartholf
2024-10-17 11:19:12 +02:00
committed by GitHub
parent 763262c108
commit ddcbd0afb0
500 changed files with 0 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
-- P5-6694 Belgian fallback locales
-- Make Dutch the fallback locale of Belgian Dutch
UPDATE locales SET fallback_id = (SELECT id from locales where value = 'nl_NL') WHERE value = 'nl_BE';
-- Make French the fallback locale of Belgian French
UPDATE locales SET fallback_id = (SELECT id from locales where value = 'fr_FR') WHERE value = 'fr_BE';
-- Delete all text values with identical fallback versions
with rows_to_delete as (
select
texts_to_delete.textid,
texts_to_delete.locale_id
from
"i18n-texts_data" texts_to_delete
join locales locale_for_deleted on texts_to_delete.locale_id = locale_for_deleted.id
join "i18n-texts_data" texts_fallback on texts_to_delete.textid = texts_fallback.textid and locale_for_deleted.fallback_id = texts_fallback.locale_id
join "i18n-texts" on texts_to_delete.textid = "i18n-texts".textid
where
locale_for_deleted.fallback_id is not null
and texts_to_delete.text = texts_fallback.text
-- stock product titles are not fallback aware
and not (category = 'productTitles' and "i18n-texts".name in (select path from "product-stockproducts" join "product-products" using (productid)))
)
DELETE
FROM "i18n-texts_data" texts_data
USING rows_to_delete
WHERE texts_data.textid = rows_to_delete.textid AND texts_data.locale_id = rows_to_delete.locale_id
;