Hi, To make a migration irreversable, one has to execute "raise IrreversibleMigration". This is how it''s documented everywhere. However, when I do that, I get this: rake aborted! uninitialized constant IrreversibleMigration This is the migration (the file is called 022_ldap_fix.rb): class LdapFix < ActiveRecord::Migration def self.up execute File.open( __FILE__.gsub(/\.rb$/, ''.pgsql'') ).read end def self.down raise IrreversibleMigration end end I''m using a frozen gem of Rails 1.1. What am I doing wrong?
But what''s wrong ? it seems that your db have been rolled back to this version+1 migration and then : rake stops... Thus, your migration is reversible as the previous versions can''t be executed -- Posted via http://www.ruby-forum.com/.
Nuno wrote:> But what''s wrong ? it seems that your db have been rolled back to this > version+1 migration and then : rake stops... > > Thus, your migration is reversible as the previous versions can''t be > executed >In practice yes, but that would mean you could just execute "adsflkjadslfk asldfkj asdflk" for every irreversable migration... Not very eloquent. In fact, downright ugly... Rails has methods like ActiveRecord::Base.reload just to avoid doing ActiveRecord::Base.find(sameobject.id), or a :first modifier on the find method to avoid having to lookup result 0 in the resultset yourself. Programming isn''t just about making things work, the programming itself should be clean and intuitive.