-- +goose Up
-- Persist the locale captured at send-email-code so it can be replayed at
-- confirm-email-code when the auth flow needs `preferred_language` to seed
-- a freshly-created `accounts` row. Existing rows default to '' and are
-- treated by the auth service as "no captured locale", in which case the
-- service falls back to the geoip-derived language and finally to "en".

ALTER TABLE backend.auth_challenges
    ADD COLUMN preferred_language text NOT NULL DEFAULT '';

-- +goose Down
ALTER TABLE backend.auth_challenges
    DROP COLUMN preferred_language;
