-- Grant permissions for photo_favorites table in punimtag_auth database
-- Run this as PostgreSQL superuser: sudo -u postgres psql -d punimtag_auth -f grant-favorites-permissions.sql
-- 
-- BEFORE RUNNING: Edit this file and replace 'your_user' with your actual database username
-- (Check your DATABASE_URL_AUTH environment variable to see which user you're using)

-- Connect to the auth database (if not already connected)
\c punimtag_auth

-- Grant permissions on photo_favorites table
-- Replace 'your_user' with your actual username (e.g., the user from DATABASE_URL_AUTH)
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE photo_favorites TO your_user;

-- Grant usage on sequence (needed for auto-increment IDs)
GRANT USAGE, SELECT ON SEQUENCE photo_favorites_id_seq TO your_user;

\echo '✅ Permissions granted on photo_favorites table!'
\echo ''
\echo 'The following permissions were granted:'
\echo '  - SELECT, INSERT, UPDATE, DELETE on photo_favorites'
\echo '  - USAGE, SELECT on photo_favorites_id_seq sequence'






