Skip to content

Commit ca645a2

Browse files
committed
re-invent add_column_options! (due next AR 4.1) to provide compatibilty
Oracle, MS-SQL and DB2 adapters still need it as they are not refactored to the knew "AREL-style" `SchemaCreation`, this will make sure they work with 4.1
1 parent 01c6d10 commit ca645a2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/arjdbc/jdbc/adapter.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,20 @@ def new_table_definition(table_definition, *args)
702702
end
703703
private :new_table_definition
704704

705+
#
706+
707+
# Provides backwards-compatibility on ActiveRecord 4.1 for DB adapters
708+
# that override this and than call super expecting to work.
709+
# @note This method is available in 4.0 but won't be in 4.1
710+
# @private
711+
def add_column_options!(sql, options)
712+
sql << " DEFAULT #{quote(options[:default], options[:column])}" if options_include_default?(options)
713+
# must explicitly check for :null to allow change_column to work on migrations
714+
sql << " NOT NULL" if options[:null] == false
715+
sql << " AUTO_INCREMENT" if options[:auto_increment] == true
716+
end
717+
public :add_column_options!
718+
705719
end
706720

707721
# @return whether `:prepared_statements` are to be used

0 commit comments

Comments
 (0)