P5-6103 Add locale to i18n-texts_data (#137)

This commit is contained in:
fredrikphotowall
2020-10-29 12:26:21 +01:00
committed by GitHub
parent ae64712576
commit 9ab43ec22f
+15
View File
@@ -0,0 +1,15 @@
-- P5-6103 Add i18n-texts_data.locale_id
ALTER TABLE "i18n-texts_data" ADD COLUMN locale_id INTEGER;
ALTER TABLE "i18n-texts_data"
ADD CONSTRAINT locale_fkey
FOREIGN KEY (locale_id)
REFERENCES locales(id) MATCH SIMPLE;
-- Populate locale ids
UPDATE "i18n-texts_data" SET locale_id = (SELECT id FROM locales WHERE value = language || '_' || territory);
-- Add not null constraint
ALTER TABLE "i18n-texts_data" ALTER COLUMN locale_id SET NOT NULL;