Sha256: 283e4377156f83026be1a3cc9489ad13d62e85f4b08f6269d43b5f05f4ea4e30

Contents?: true

Size: 787 Bytes

Versions: 5

Compression:

Stored size: 787 Bytes

Contents

#
# Cookbook Name:: postgresql
# Recipe:: setup_databases
#

databases = node["postgresql"]["databases"]

# setup databases
databases.each do |db|
  db_action = (db["action"] || "create").to_sym
  db_extensions = Array(db["extensions"])
  db_languages  = Array(db["languages"])

  postgresql_database db["name"] do
    owner db["owner"]
    encoding db["encoding"]
    template db["template"]
    locale db["locale"]
    action db_action
  end

  # check for extensions/languages to install from `databases` attribute key
  next unless db_action == :create

  db_extensions.each do |extension|
    postgresql_extension extension do
      database db["name"]
    end
  end

  db_languages.each do |language|
    postgresql_language language do
      database db["name"]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
from-scratch-0.7.0 cookbooks/postgresql/recipes/setup_databases.rb
from-scratch-0.6.0 cookbooks/postgresql/recipes/setup_databases.rb
from-scratch-0.5.0 cookbooks/postgresql/recipes/setup_databases.rb
from-scratch-0.3.0 cookbooks/postgresql/recipes/setup_databases.rb
from-scratch-0.2.0 cookbooks/postgresql/recipes/setup_databases.rb