From 02c21bc9868762e29edece16ad91d46c39a4dac1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Jan 2005 23:15:22 +0000 Subject: 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 --- railties/fresh_rakefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'railties/fresh_rakefile') diff --git a/railties/fresh_rakefile b/railties/fresh_rakefile index 437c999522..87263c4bff 100755 --- a/railties/fresh_rakefile +++ b/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 -- cgit v1.2.3