Skip to content
Browse files

Added support for SQLite in the auto-dumping/importing of schemas for…

… development -> test #416

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent d9e900c commit 02c21bc9868762e29edece16ad91d46c39a4dac1 @dhh dhh committed Jan 3, 2005
Showing with 8 additions and 0 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +6 −0 railties/fresh_rakefile
View
2 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]
View
6 railties/fresh_rakefile
@@ -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
@@ -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
@@ -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.
Something went wrong with that request. Please try again.