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?
on 2006-04-06 18:47
on 2006-04-06 19:47
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
on 2006-04-06 20:01
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.
on 2006-04-13 19:41
On Thursday 06 April 2006 16:43, Wiebe C. wrote: > What am I doing wrong? To answer my own question, you have to do: raise ActiveRecord::IrreversibleMigration