change_column_null is missing from activerecord-jdbcpostgresql-adapter
----------------------------------------------------------------------

                 Key: JRUBY-3608
                 URL: http://jira.codehaus.org/browse/JRUBY-3608
             Project: JRuby
          Issue Type: Bug
          Components: ActiveRecord-JDBC
    Affects Versions: ActiveRecord-JDBC-0.9.1
         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
            Reporter: Uwe Kubosch


When doing

{noformat}
    change_column_null :events, :end_at, true
{noformat}

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:

{noformat}
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
{noformat}

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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to