Skip to content

Commit

Permalink
Added support for SQLite in the auto-dumping/importing of schemas for…
Browse files Browse the repository at this point in the history
… development -> test #416

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Jan 3, 2005
1 parent d9e900c commit 02c21bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Added support for SQLite in the auto-dumping/importing of schemas for development -> test #416

* Fixed problems with dependency caching and controller hierarchies on Ruby 1.8.2 in development mode #351

* Added automated rewriting of the shebang lines on installs through the gem rails command #379 [Manfred Stienstra]
Expand Down
6 changes: 6 additions & 0 deletions railties/fresh_rakefile
Expand Up @@ -81,6 +81,8 @@ task :clone_development_structure_to_test => [ :db_structure_dump, :purge_test_d
end
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
`psql -U #{ActiveRecord::Base.configurations["test"]["username"]} -f db/development_structure.sql #{ActiveRecord::Base.configurations["test"]["database"]}`
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "sqlite"
`sqlite #{ActiveRecord::Base.configurations["test"]["dbfile"]} < db/development_structure.sql`
end
end

Expand All @@ -91,6 +93,8 @@ task :db_structure_dump do
File.open("db/development_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
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"]}`
elsif ActiveRecord::Base.configurations["development"]["adapter"] == "sqlite"
`sqlite #{ActiveRecord::Base.configurations["development"]["dbfile"]} .schema > db/development_structure.sql`
end
end

Expand All @@ -102,5 +106,7 @@ task :purge_test_database do
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
`dropdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
`createdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "sqlite"
File.delete(ActiveRecord::Base.configurations["test"]["dbfile"]) if File.exist?(ActiveRecord::Base.configurations["test"]["dbfile"])
end
end

0 comments on commit 02c21bc

Please sign in to comment.