<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,11 @@
 namespace :db do
   task :branch =&gt; &quot;branch:create_clone&quot;
 
+  # Chain onto the default load_config task
+  task :load_config =&gt; :rails_env do
+    Sevenwire::DbBranch.load_database
+  end
+
   namespace :branch do
     desc &quot;Append config/database.branch.* to .gitignore if missing&quot;
     task :setup =&gt; :environment do
@@ -49,9 +54,8 @@ namespace :db do
     task :create_clone =&gt; [:environment,:setup, :config] do
       Rake::Task['db:create:all'].invoke
       Rake::Task['db:branch:clone'].invoke 
+      puts &quot;\nPreparing the test db, if there are any pending migrations you'll need to run rake db:test:prepare after migrating.&quot;
       Rake::Task['db:test:prepare'].invoke 
-      puts &quot;Unless we ran into any errors, the branch databases have all been created.&quot;
-      puts &quot;The data from the original db has been loaded into the #{Rails.env} env branch db and test db prepared.&quot;
     end
 
     desc &quot;Clone database from original database.yml, set RAILS_ENV to switch dbs&quot;
@@ -78,7 +82,19 @@ namespace :db do
     desc &quot;Drops the branch databases and removes the branch config file&quot;
     task :purge =&gt; :environment do
       if Rails.configuration.database_configuration_file == Sevenwire::DbBranch.database_file_for_branch
-        Rake::Task['db:drop:all'].invoke
+        Sevenwire::DbBranch.load_database
+        #Rake::Task['db:drop:all'].invoke
+        ActiveRecord::Base.configurations.each_value do |config|
+          # Skip entries that don't have a database key
+          next unless config['database']
+          # Only connect to local databases
+          begin
+            puts &quot;Attempting to drop #{config['database']}&quot;
+            local_database?(config) { drop_database(config) }
+          rescue
+            puts &quot;caught and ignored exception: #{$!}&quot;
+          end
+        end
         File.unlink Sevenwire::DbBranch.database_file_for_branch
         puts &quot;Dropped branch databases and removed branch config file&quot;
       else</diff>
      <filename>tasks/db_branch_tasks.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3dc68d2293c2c323a452fa4b4fb8b989a1345086</id>
    </parent>
  </parents>
  <author>
    <name>Mike Vincent</name>
    <email>mike@cryingwhilecoding.com</email>
  </author>
  <url>http://github.com/sevenwire/db_branch/commit/d470879d65bee012e9545d92366ee436ebd65592</url>
  <id>d470879d65bee012e9545d92366ee436ebd65592</id>
  <committed-date>2009-02-12T03:53:22-08:00</committed-date>
  <authored-date>2009-02-11T20:36:28-08:00</authored-date>
  <message>More verbosity about what db's are being dropped

Added a load_config task to load the branched config

Signed-off-by: Sevenwire &lt;git@sevenwire.com&gt;</message>
  <tree>8815e15137b44c665b755ea5cbc983d3c52aef6d</tree>
  <committer>
    <name>Sevenwire</name>
    <email>git@sevenwire.com</email>
  </committer>
</commit>
