-- Create users
CREATE USER xrad_user WITH ENCRYPTED PASSWORD 'xrad_user';
CREATE USER app_user WITH ENCRYPTED PASSWORD 'app_user';

-- Grant SUPERUSER privileges
ALTER USER xrad_user WITH SUPERUSER;
ALTER USER app_user WITH SUPERUSER;

-- Create databases and set owners
CREATE DATABASE xraddb OWNER xrad_user;
CREATE DATABASE appdb OWNER app_user;

-- Restore the database dumps
\connect xraddb;
\i /docker-entrypoint-initdb.d/xraddb.xsquare.pgsql;

\connect appdb;
\i /docker-entrypoint-initdb.d/appdb.xsquare.pgsql;