Sha256: 73b563d96fe8c6098e1cedeb51841f77d3e390b670a171eefaf317281375aaaf
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
# encoding: UTF-8 module Spontaneous::Cli class Init class Postgresql < Db def config_for_environment(env) site_config, admin_config = super admin_config[:database] = "postgres" [site_config, admin_config] end # On some machines the db creation fails due to incompabilities between the UTF8 encoding # and the configured locale. # You can force a locale for the db by adding LC_COLLATE & LC_CTYPE params # to the CREATE command: # # LC_COLLATE='C.UTF-8' LC_CTYPE='C.UTF-8' # # but I don't know a good/the best way to determine the most appropriate UTF-8 locale # C.UTF-8 doesn't exist on OS X. def create_database_commands(config) create_cmd = %(CREATE DATABASE "#{config[:database]}" WITH TEMPLATE=template0 ENCODING='UTF8') cmds = [] unless config[:user].blank? create_cmd << %( OWNER="#{config[:user]}") cmds << [%(CREATE ROLE "#{config[:user]}" LOGIN PASSWORD '#{config[:password]}'), false] end cmds << [create_cmd, true] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems