Hi
I’ve created a migration called
make_customer_type_id_not_null_for_customers. The migration .rb file
looks like this:
class MakeCustomerTypeIdNotNullForCustomers < ActiveRecord::Migration
def self.up
change_column(:customers, :customer_type_id, :integer, { :null =>
false })
end
def self.down
change_column(:customers, :customer_type_id, :integer, { :null =>
true })
end
end
Running “rake migrate” indicates everything is ok:
== MakeCustomerTypeIdNotNullForCustomers: migrating
– change_column(:customers, :customer_type_id, :integer,
{:null=>false})
-> 0.1250s
== MakeCustomerTypeIdNotNullForCustomers: migrated (0.1250s)
However, this is misleading, since the column was in fact not changed,
and Null values are still accepted, seriously compromising data
integrity.
Has anyone encountered this problem? Is it caused by any mistake I
can fix? The problem exists on Rails 1.1.2 with PostgresSQL 8.1.3 on
both Windows and Debian Stable.