Permission fix

This commit is contained in:
Koncept Kit
2025-12-17 01:41:29 +07:00
parent 1050abd830
commit b7ab1a897f
3 changed files with 29 additions and 1 deletions

27
add_finance_to_enum.sql Normal file
View File

@@ -0,0 +1,27 @@
-- Add 'finance' value to UserRole enum type
-- This is needed because we added a new finance role to the dynamic RBAC system
BEGIN;
-- Add the finance value to the userrole enum if it doesn't already exist
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_enum
WHERE enumlabel = 'finance'
AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'userrole')
) THEN
ALTER TYPE userrole ADD VALUE 'finance';
RAISE NOTICE 'Added finance to userrole enum';
ELSE
RAISE NOTICE 'finance already exists in userrole enum';
END IF;
END$$;
COMMIT;
-- Verify the enum values
SELECT enumlabel
FROM pg_enum
WHERE enumtypid = (SELECT oid FROM pg_type WHERE typname = 'userrole')
ORDER BY enumsortorder;