-- IRIS Database User Creation Script
-- Execute this as PostgreSQL superuser (postgres)
-- Create dedicated user for IRIS
CREATE USER iris_user WITH PASSWORD 'IrisSecure2025!@#$%^&*';
-- Grant database privileges
GRANT ALL PRIVILEGES ON DATABASE iris_db TO iris_user;
-- Connect to iris_db and grant schema privileges
\c iris_db
-- Grant schema privileges
GRANT ALL ON SCHEMA public TO iris_user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO iris_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO iris_user;
-- Set default privileges for future objects
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO iris_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO iris_user;
-- Verify user creation
SELECT rolname, rolsuper, rolcreaterole, rolcreatedb FROM pg_roles WHERE rolname = 'iris_user';
-- Test connection (you can run this separately)
-- \c iris_db iris_user