diff --git a/pillar.example b/pillar.example index f3bdd05..8250e12 100644 --- a/pillar.example +++ b/pillar.example @@ -52,6 +52,9 @@ postgres: lc_ctype: 'C.UTF-8' lc_collate: 'C.UTF-8' # optional extensions to enable on database + schemas: + uuid_ossp: + owner: localUser extensions: - uuid-ossp db2: diff --git a/postgres/init.sls b/postgres/init.sls index c8577b9..a560774 100644 --- a/postgres/init.sls +++ b/postgres/init.sls @@ -118,6 +118,20 @@ postgres-db-{{ name }}: - postgres_user: postgres-user-{{ db.get('user') }} {% endif %} +{% if db.schemas is defined %} +{% for schema, schema_args in db.schemas.items() %} +postgres-schema-{{ schema }}-for-db-{{ name }}: + postgres_schema.present: + - name: {{ schema }} + - dbname: {{ name }} +{% if schema_args is not none %} +{% for arg, value in schema_args.items() %} + - {{ arg }}: {{ value }} +{% endfor %} +{% endif %} +{% endfor %} +{% endif %} + {% if db.extensions is defined %} {% for ext in db.extensions %} postgres-ext-{{ ext }}-for-db-{{ name }}: