%for %%server in %%accounts.remotes %set %%name = %%normalize_family(%%server) CREATE DATABASE "%%name"; CREATE ROLE "%%name" WITH LOGIN ENCRYPTED PASSWORD '%%accounts["remote_" + %%name]["password_" + %%name]'; ALTER USER "%%name" PASSWORD '%%accounts["remote_" + %%name]["password_" + %%name]'; GRANT ALL PRIVILEGES ON DATABASE "%%name" TO "%%name"; %end for