tchandy/octopus — pull request #128 by ragalie (2012-11-13 18:01:32+00:00)
Title: db:create:all task doesn't create missing databases

The db:create:all task attempts to connect to each database and creates it if the database throws an error: https://github.com/rails/rails/blob/v3.2.8/activerecord/lib/active_record/railties/databases.rake#L67-L68

Because AR::Base.establish_connection doesn't work with octopus, AR::Base.connection returns the current shard (which may already exist) rather than the requested database connection. The task then incorrectly reports that databases exist even though they do not.