2016-02-02 19:39:35 +05:30
{####################################################}
{# This will be specific macro for Role objects #}
{####################################################}
2016-01-09 17:59:56 +05:30
{% macro APPLY(conn, database, role, param, value) -%}
2016-02-02 19:39:35 +05:30
ALTER {% if role %}ROLE {{ self.conn|qtIdent(role) }}{% if database %} IN DATABASE {{ conn|qtIdent(database) }}{% endif %}{% else %}DATABASE {{ conn|qtIdent(database) }}{% endif %}
2016-07-18 11:50:42 +01:00
2019-07-04 15:00:29 +01:00
SET {{ conn|qtIdent(param) }} TO {{ value|qtLiteral }};
2016-01-09 17:59:56 +05:30
{%- endmacro %}
2016-01-11 13:06:42 +05:30
{% macro RESET(conn, database, role, param) -%}
2016-02-02 19:39:35 +05:30
ALTER {% if role %}ROLE {{ self.conn|qtIdent(role) }}{% if database %} IN DATABASE {{ conn|qtIdent(database) }}{% endif %}{% else %}DATABASE {{ conn|qtIdent(database) }}{% endif %}
2016-07-18 11:50:42 +01:00
2016-02-02 19:39:35 +05:30
RESET {{ conn|qtIdent(param) }};
{%- endmacro %}
{################################################}
{# This will be generic macro for other objects #}
{################################################}
2016-02-03 16:35:40 +05:30
{% macro SET(conn, object_type, object_name, options) -%}
2016-02-02 19:39:35 +05:30
ALTER {{object_type}} {{ conn|qtIdent(object_name) }}
2016-02-03 16:35:40 +05:30
SET ({% for opt in options %}{% if loop.index != 1 %}
2018-02-02 14:58:29 +01:00
, {% endif %}{{ conn|qtIdent(opt.name) }}={{ opt.value }}{% endfor %});
2016-02-02 19:39:35 +05:30
{%- endmacro %}
2016-02-03 16:35:40 +05:30
{% macro UNSET(conn, object_type, object_name, options) -%}
2016-02-02 19:39:35 +05:30
ALTER {{object_type}} {{ conn|qtIdent(object_name) }}
2016-02-03 16:35:40 +05:30
RESET ({% for opt in options %}{% if loop.index != 1 %}
, {% endif %}{{ conn|qtIdent(opt.name) }}{% endfor %});
2019-04-18 12:31:35 +05:30
{%- endmacro %}