This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store DataMapper::MigrationRunner#migrations in a class variable
Fixes an issue where migrations don't get run at all in dm-rails rake tasks. Further explanation can be found in the related ticket on LH. This is weird. Maybe it has to do something with the way rails loads the rake tasks and invokes our stuff. No idea ... [#1214 state:resolved]
- Loading branch information
cd9d62e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should put this into a gem release and bump the dependency on dm-rails, this is still broken in rails 3 unless you explicitly point your Gemfile at this repo.
cd9d62e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'll do it if no one thinks it is a bad idea)
cd9d62e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this ever released?
rake db:migrate
does nothing in Rails 3.0.9.cd9d62e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, in fact, even with dm-migrations pointed to this repo, it does nothing. I must be doing it wrong. It's the first migration I've tried writing with it.
cd9d62e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fault.
db/migrations/*.rb != db/migrate/*.rb
Carry on...
cd9d62e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ticket link for those unfortunate to have found this issue the hard way: http://datamapper.lighthouseapp.com/projects/20609/tickets/1214
This fix should have been released in a bug fix 1.0 release.
To work around the failure, you have to define migrations and invoke migrate_up! (or whatever) on the same object. Datamapper includes DataMapper::MigrationRunner into the global namespace, thus if you call migrate globally you have to call migrate_up! globally as well (assuming this works, not tested).
I changed migration definition to read:
DataMapper.migration '2011-10-14T20:09:23Z', :change_commit_message_to_text do
and then invoke it like this:
DataMapper.migrate_up!