-- Grant write permissions to viewer_readonly user
-- Run this script as a PostgreSQL superuser (e.g., postgres user)
-- 
-- Option 1: Grant write permissions to existing viewer_readonly user
-- (Use this if you want to use the same user for read and write)

GRANT INSERT, UPDATE ON TABLE people TO viewer_readonly;
GRANT INSERT, UPDATE ON TABLE faces TO viewer_readonly;

-- Grant usage on sequences (needed for auto-increment IDs)
GRANT USAGE, SELECT ON SEQUENCE people_id_seq TO viewer_readonly;

-- Display success message
\echo 'Write permissions granted to viewer_readonly user!'
\echo 'You can now use DATABASE_URL for both read and write operations.'



