As I have reported on the rubyonrails-core mailing list, I have a working solution. Right now, this is a patch against Rails Edge. I am trying to move this code into a plugin, but I have problems with dependencies. I override methods in
Rails::Generator::Base, but there is no file named
rails/generator/base.rb. That constant is defined in
rails_generator/commands.rb, which makes it very hard for the ActiveSupport dependency mechanism to load it.
What this patch does:
- Generates migrations where the version number is replaced with a UTC timestamp;
- Allows migrating up and down, ordering migrations by name;
- Records which migrations were run in the
This patch has no tests, but from the command line it seems to work. It even works with the
db:sessions:create Rake task.
Enjoy, and either leave comments here or at email@example.com.