1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

More postgresql rakefile tweaking #875

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@938 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-03-20 16:55:39 +00:00
parent 694aafaa9d
commit 16287608bb
2 changed files with 9 additions and 2 deletions

View file

@ -2,9 +2,13 @@
* Fixed webrick_server cookie handling to allow multiple cookes to be set at once #800, #813 [dave@cherryville.org]
* Fixed the Rakefile's interaction with postgresql use PGPASSWORD and PGHOST in the environment to fix prompting for passwords when connecting to a remote db and local socket connections. Also added a '-x' flag to pg_dump which stops it dumping privileges #807 [rasputnik]
* Fixed the Rakefile's interaction with postgresql to:
* Fixed the Rakefile's interaction with postgresql to quote the user name and use template0 when dumping so the functions doesn't get dumped too #855 [pburleson]
1. Use PGPASSWORD and PGHOST in the environment to fix prompting for
passwords when connecting to a remote db and local socket connections.
2. Added a '-x' flag to pg_dump which stops it dumping privileges #807 [rasputnik]
3. Quote the user name and use template0 when dumping so the functions doesn't get dumped too #855 [pburleson]
4. Use the port if available #875 [madrobby]
*0.10.1* (7th March, 2005)

View file

@ -121,6 +121,7 @@ task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do
end
when "postgresql"
ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
ENV['PGPORT'] = abcs["test"]["host"] if abcs["test"]["port"]
ENV['PGPASSWORD'] = abcs["test"]["password"]
`psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
when "sqlite", "sqlite3"
@ -139,6 +140,7 @@ task :db_structure_dump => :environment do
File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
when "postgresql"
ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
ENV['PGPORT'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["port"]
ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"]
`pg_dump -U "#{abcs[RAILS_ENV]["username"]}" -s -x -f db/#{RAILS_ENV}_structure.sql #{abcs[RAILS_ENV]["database"]}`
when "sqlite", "sqlite3"
@ -157,6 +159,7 @@ task :purge_test_database => :environment do
ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"])
when "postgresql"
ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
ENV['PGPORT'] = abcs["test"]["host"] if abcs["test"]["port"]
ENV['PGPASSWORD'] = abcs["test"]["password"]
`dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}`
`createdb -T template0 -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}`