-- Complete Authentication Service Schema Migration
-- Creates schema, tables, indexes, functions, triggers, and permissions

-- Note: Schema and tables already created, just adding missing permissions

-- Grant permissions to auth_service_user (not auth_service)
GRANT USAGE ON SCHEMA auth TO auth_service_user;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA auth TO auth_service_user;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA auth TO auth_service_user;

ALTER DEFAULT PRIVILEGES IN SCHEMA auth
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO auth_service_user;

ALTER DEFAULT PRIVILEGES IN SCHEMA auth
GRANT USAGE, SELECT ON SEQUENCES TO auth_service_user;
