dataset/seed/postgresql/templates/postgresql.sql

15 lines
858 B
SQL

#RISOTTO: do not compare
%set %%new_accounts = [('rougail_test', 'rougail_test', %%get_password(server_name=%%domain_name_eth0, username='rougail_test', description="remote", type="cleartext", hide=%%hide_secret, temporary=True))]
%for %%server in %%accounts.remotes
%set %%name = %%normalize_family(%%server)
%set %%database = %%accounts["remote_" + %%name]["database_" + %%name]
%set %%username = %%accounts["remote_" + %%name]["username_" + %%name]
%set %%password = %%accounts["remote_" + %%name]["password_" + %%name]
%%new_accounts.append((%%database, %%username, %%password))%slurp
%end for
%for %%database, %%name, %%password in %%new_accounts
CREATE DATABASE "%%name";
CREATE ROLE "%%name" WITH LOGIN ENCRYPTED PASSWORD '%%password';
ALTER USER "%%name" PASSWORD '%%password';
GRANT ALL PRIVILEGES ON DATABASE "%%name" TO "%%database";
%end for