Permalink
Browse files

Adding postgresql template option when executing db:test:clone_structure

Specify the template to use in config/database.yml, e.g.

  test:
    adapter: postgresql
    template: template_postgis

If no template is specified, postgresql defaults to template1
  • Loading branch information...
1 parent 18605ad commit 4690bee301588b92fe8c0ae1026c14336e1be57c @kytrinyx kytrinyx committed with jeremy Jan 6, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/railties/databases.rake
@@ -409,7 +409,7 @@ db_namespace = namespace :db do
ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
- `psql -U "#{abcs["test"]["username"]}" -f #{Rails.root}/db/#{Rails.env}_structure.sql #{abcs["test"]["database"]}`
+ `psql -U "#{abcs["test"]["username"]}" -f #{Rails.root}/db/#{Rails.env}_structure.sql #{abcs["test"]["database"]} #{abcs["test"]["template"]}`
when "sqlite", "sqlite3"
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
`#{abcs["test"]["adapter"]} #{dbfile} < #{Rails.root}/db/#{Rails.env}_structure.sql`

0 comments on commit 4690bee

Please sign in to comment.