-- Grant all permissions to songlyric_user
-- Run this as postgres user:
-- sudo -u postgres psql -d church_songlyric -f grant_permissions.sql

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO songlyric_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO songlyric_user;
GRANT ALL PRIVILEGES ON SCHEMA public TO songlyric_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO songlyric_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO songlyric_user;

-- Or transfer ownership:
ALTER TABLE profiles OWNER TO songlyric_user;
ALTER TABLE songs OWNER TO songlyric_user;
ALTER TABLE plans OWNER TO songlyric_user;
ALTER TABLE plan_songs OWNER TO songlyric_user;
ALTER TABLE profile_songs OWNER TO songlyric_user;
ALTER TABLE profile_song_keys OWNER TO songlyric_user;

\echo 'Permissions granted successfully!'
