Migration Trouble

Having an issue getting a migration to do what I want it to. My
migration file is as follows:

class AddActsAsParanoidFields < ActiveRecord::Migration
def self.up
add_column :departments, :deleted_at, :datetime
Department.find(:all, :conditions => “name = ‘Operations’”).each
{|d| d.update_attribute(‘deleted_at’, Time.now)}

add_column :employees, :deleted_at, :datetime
Employee.find(:all, :conditions => "active = 0").each {|e| 

e.update_attribute(‘deleted_at’,Time.now) }

def self.down
remove_column :departments, :deleted_at
add_column :employees, :active, :boolean, :default => true, :null =>
Employee.find(:all, :conditions => ‘deleted_at != null’).each {|e|
e.update_attribute(‘active’, false)}

After I run my migration, I check my database and the Department.find…
and Employee.find… lines haven’t successfully executed. Yet if I open
up a console window immediately after doing the migration I can copy and
paste those same lines from my code into the console and it works just
the way its supposed to.

Anybody have any ideas why?


Answered my own question…

The database columns in my models had been modified so I needed to call
Department.reset_column_information first before adding new data.

I don’t get why that method isn’t called automatically after each table
modification method, but it isn’t.