feat(user): add deterministic avatar color to AppUser
Adds color field assigned from an 8-colour palette keyed on the user's UUID hash (Math.abs(id.hashCode()) % 8). Fires via @PrePersist/@PreUpdate/@PostLoad so both new and existing users get the correct colour at runtime. V47 migration adds the column and fixes the V46 REVOKE bug that hardcoded role name 'app_user' instead of CURRENT_USER. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
-- Add deterministic avatar color to app_users.
|
||||
-- Assigned at application layer (AppUser.java) from a fixed 8-colour palette.
|
||||
-- Also corrects V46's REVOKE which hardcoded 'app_user' instead of CURRENT_USER.
|
||||
|
||||
ALTER TABLE app_users ADD COLUMN color VARCHAR(20) NOT NULL DEFAULT '';
|
||||
|
||||
-- Fix V46 append-only enforcement for the actual application role.
|
||||
REVOKE UPDATE, DELETE ON audit_log FROM CURRENT_USER;
|
||||
Reference in New Issue
Block a user