Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Fedora 10, Sun Java 1.6.0_11, JRuby 1.2.0, activerecord-jdbc-adapter 0.9.1, activerecord-jdbcpostgresql-adapter 0.9.1
Description
When doing
change_column_null :events, :end_at, true
in a migration script, a "method missing" exception is thrown. This works on older versions of ar-jdbc and on MRI with regular postgresql adapter.
As a workaround, inserting the following code in environment.rb in Rails, or other appropriate setup code will add the missing method:
module ::JdbcSpec::PostgreSQL
def change_column_null(table_name, column_name, null, default = nil)
unless null || default.nil?
execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL")
end
execute("ALTER TABLE #{quote_table_name(table_name)} ALTER #{quote_column_name(column_name)} #{null ? 'DROP' : 'SET'} NOT NULL")
end
Please add back the missing method. It should already be defined in the regular postgresql adapter, so we really only need to not disable it.
In ar-jdbc dbfba06.