-- The keys cannot be recovered from their hashes. Rolling back gives every -- user a new random key; Subsonic clients using apiKey need the new one. ALTER TABLE users ADD COLUMN api_token text; UPDATE users SET api_token = md5(random()::text || id::text || clock_timestamp()::text); ALTER TABLE users ALTER COLUMN api_token SET NOT NULL; ALTER TABLE users ADD CONSTRAINT users_api_token_key UNIQUE (api_token); ALTER TABLE users DROP COLUMN api_token_hash;