]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-1412: Fix handling of null salt when upgrading users table. (#407)
authorRay Lee <ray.lee@lyrasis.org>
Thu, 9 May 2024 16:59:09 +0000 (12:59 -0400)
committerGitHub <noreply@github.com>
Thu, 9 May 2024 16:59:09 +0000 (12:59 -0400)
services/authentication/pstore/src/main/resources/db/postgresql/authentication.sql

index f27a08666cc39e8e3c5cbeb5c1c988b74f50ff2c..4e4df22403109d4d0a202254f59ffac0549c8791 100644 (file)
@@ -14,7 +14,16 @@ ALTER TABLE users ADD COLUMN IF NOT EXISTS salt VARCHAR(128);
 
 -- Upgrade older users tables to 8.0
 
-UPDATE users SET passwd = concat('{SHA-256}', '{', salt, '}', passwd)  WHERE left(passwd, 1) <> '{';
+UPDATE users
+SET passwd = concat(
+  '{SHA-256}',
+  CASE
+    WHEN salt IS NULL THEN ''
+    ELSE concat('{', salt, '}')
+  END,
+  passwd
+)
+WHERE left(passwd, 1) <> '{';
 
 -- Create tokens table required in 8.0