mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-16 23:24:12 +00:00
fix: migration fails on postgres (#762)
This commit is contained in:
committed by
GitHub
parent
4c76de45ed
commit
35d5f887ce
@@ -1,25 +1,34 @@
|
|||||||
-- Normalize (form NFC) all existing values in the database
|
-- Normalize (form NFC) all existing values in the database
|
||||||
UPDATE api_keys SET
|
DO $$
|
||||||
name = normalize(name, 'nfc'),
|
BEGIN
|
||||||
description = normalize(description, 'nfc');
|
-- This function is available only if the server's encoding is UTF8
|
||||||
|
IF current_setting('server_encoding') = 'UTF8' THEN
|
||||||
|
UPDATE api_keys SET
|
||||||
|
name = normalize(name, NFC),
|
||||||
|
description = normalize(description, NFC);
|
||||||
|
|
||||||
UPDATE app_config_variables SET
|
UPDATE app_config_variables SET
|
||||||
"value" = normalize("value", 'nfc')
|
"value" = normalize("value", NFC)
|
||||||
WHERE "key" = 'appName';
|
WHERE "key" = 'appName';
|
||||||
|
|
||||||
UPDATE custom_claims SET
|
UPDATE custom_claims SET
|
||||||
"key" = normalize("key", 'nfc'),
|
"key" = normalize("key", NFC),
|
||||||
"value" = normalize("value", 'nfc');
|
"value" = normalize("value", NFC);
|
||||||
|
|
||||||
UPDATE oidc_clients SET
|
UPDATE oidc_clients SET
|
||||||
name = normalize(name, 'nfc');
|
name = normalize(name, NFC);
|
||||||
|
|
||||||
UPDATE users SET
|
UPDATE users SET
|
||||||
username = normalize(username, 'nfc'),
|
username = normalize(username, NFC),
|
||||||
email = normalize(email, 'nfc'),
|
email = normalize(email, NFC),
|
||||||
first_name = normalize(first_name, 'nfc'),
|
first_name = normalize(first_name, NFC),
|
||||||
last_name = normalize(last_name, 'nfc');
|
last_name = normalize(last_name, NFC);
|
||||||
|
|
||||||
UPDATE user_groups SET
|
UPDATE user_groups SET
|
||||||
friendly_name = normalize(friendly_name, 'nfc'),
|
friendly_name = normalize(friendly_name, NFC),
|
||||||
"name" = normalize("name", 'nfc');
|
"name" = normalize("name", NFC);
|
||||||
|
ELSE
|
||||||
|
RAISE NOTICE 'Skipping normalization: server_encoding is %', current_setting('server_encoding');
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
Reference in New Issue
Block a user