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

Dump development database, not test database

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2004-11-25 15:53:30 +00:00
parent 1042de2370
commit a09824cfcc

View file

@ -84,11 +84,11 @@ end
desc "Dump the database structure to a SQL file"
task :db_structure_dump do
if ActiveRecord::Base.configurations["test"]["adapter"] == "mysql"
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations["test"])
if ActiveRecord::Base.configurations["development"]["adapter"] == "mysql"
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations["development"])
File.open("db/development_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
`pg_dump -U #{ActiveRecord::Base.configurations["test"]["username"]} -s -f db/development_structure.sql #{ActiveRecord::Base.configurations["test"]["database"]}`
elsif ActiveRecord::Base.configurations["development"]["adapter"] == "postgresql"
`pg_dump -U #{ActiveRecord::Base.configurations["development"]["username"]} -s -f db/development_structure.sql #{ActiveRecord::Base.configurations["development"]["database"]}`
end
end