Files
Rikard BartholfandGitHub ddcbd0afb0 Archive old migrations (#426)
* Archive old migrations

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

16 lines
464 B
SQL

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