aboutsummaryrefslogtreecommitdiffstats
path: root/railties/fresh_rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'railties/fresh_rakefile')
-rwxr-xr-xrailties/fresh_rakefile6
1 files changed, 6 insertions, 0 deletions
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