Migrate the test database to 0 instead of trying to "drop database".
[arvados.git] / services / api / Rakefile
1 #!/usr/bin/env rake
2 # Add your own tasks in files placed in lib/tasks ending in .rake,
3 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
5 require File.expand_path('../config/application', __FILE__)
6
7 Server::Application.load_tasks
8
9 # http://www.pervasivecode.com/blog/2007/09/22/making-rails-raketest-not-drop-your-pgsql-database/
10 #
11 # don't drop the test database; migrate it back to 0
12 Rake::TaskManager.class_eval do
13   def delete_task(task_name)
14     @tasks.delete(task_name.to_s)
15   end
16   Rake.application.delete_task("db:test:purge")
17 end
18 namespace :db do
19     namespace :test do
20         task :purge do
21             ActiveRecord::Migrator.migrate("db/migrate/", 0)
22         end
23     end
24 end