mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 04:34:15 -04:00
fix: rename 'no' roles to 'nb'
This commit is contained in:
parent
b282277271
commit
fb17f4c095
@ -57,6 +57,25 @@ UPDATE translations
|
||||
SET locale = 'nb'
|
||||
WHERE locale = 'no';
|
||||
|
||||
-- The users.roles column is a pipe-separated string of items like:
|
||||
-- <locale>-<endpoint>
|
||||
-- e.g. "nl-some-route|nn-*|en-*"
|
||||
--
|
||||
-- We want to rename "no-" to "nb-", but *only* if it is at the start of
|
||||
-- the role token (immediately after "|" or at the start of the string).
|
||||
-- We do NOT rename "en-no-something".
|
||||
|
||||
-- a) Replace occurrences after a pipe: "|no-" => "|nb-"
|
||||
UPDATE users
|
||||
SET roles = REPLACE(roles, '|no-', '|nb-')
|
||||
WHERE roles LIKE '%|no-%';
|
||||
|
||||
-- b) If the string *starts* with "no-", rename it to "nb-"
|
||||
-- (We add a check for roles starting with 'no-')
|
||||
UPDATE users
|
||||
SET roles = 'nb-' || SUBSTR(roles, 4) -- remove "no-" and prepend "nb-"
|
||||
WHERE roles LIKE 'no-%';
|
||||
|
||||
-- Down
|
||||
|
||||
UPDATE blog_reactions
|
||||
@ -110,3 +129,13 @@ WHERE locale = 'nb';
|
||||
UPDATE translations
|
||||
SET locale = 'no'
|
||||
WHERE locale = 'nb';
|
||||
|
||||
-- Same as above, but for nb -> no
|
||||
|
||||
UPDATE users
|
||||
SET roles = REPLACE(roles, '|nb-', '|no-')
|
||||
WHERE roles LIKE '%|nb-%';
|
||||
|
||||
UPDATE users
|
||||
SET roles = 'no-' || SUBSTR(roles, 4)
|
||||
WHERE roles LIKE 'nb-%';
|
||||
|
Loading…
x
Reference in New Issue
Block a user