Support Rails 4 Database Tasks - Fixes #402

Here's a starting point for supporting Rake database tasks in Rails 4.

No tests at the moment - although now that these have been moved into reusable methods, it might be easier to test.