@@ -130,7 +130,7 @@ def change_column(table_name, column_name, type, options = {})
130130 remove_indexes ( table_name , column_name )
131131 end
132132 sql_commands << "UPDATE #{ quote_table_name ( table_name ) } SET #{ quote_column_name ( column_name ) } =#{ quote_default_expression ( options [ :default ] , column_object ) } WHERE #{ quote_column_name ( column_name ) } IS NULL" if !options [ :null ] . nil? && options [ :null ] == false && !options [ :default ] . nil?
133- sql_commands << "ALTER TABLE #{ quote_table_name ( table_name ) } ALTER COLUMN #{ quote_column_name ( column_name ) } #{ type_to_sql ( type , options [ :limit ] , options [ :precision ] , options [ :scale ] ) } "
133+ sql_commands << "ALTER TABLE #{ quote_table_name ( table_name ) } ALTER COLUMN #{ quote_column_name ( column_name ) } #{ type_to_sql ( type , limit : options [ :limit ] , precision : options [ :precision ] , scale : options [ :scale ] ) } "
134134 sql_commands [ -1 ] << ' NOT NULL' if !options [ :null ] . nil? && options [ :null ] == false
135135 if options_include_default? ( options )
136136 sql_commands << "ALTER TABLE #{ quote_table_name ( table_name ) } ADD CONSTRAINT #{ default_constraint_name ( table_name , column_name ) } DEFAULT #{ quote_default_expression ( options [ :default ] , column_object ) } FOR #{ quote_column_name ( column_name ) } "
@@ -194,7 +194,7 @@ def extract_foreign_key_action(action, fk_name)
194194 end
195195 end
196196
197- def type_to_sql ( type , limit = nil , precision = nil , scale = nil )
197+ def type_to_sql ( type , limit : nil , precision : nil , scale : nil , ** )
198198 type_limitable = %w( string integer float char nchar varchar nvarchar ) . include? ( type . to_s )
199199 limit = nil unless type_limitable
200200 case type . to_s
@@ -240,7 +240,7 @@ def change_column_null(table_name, column_name, allow_null, default = nil)
240240 if !allow_null . nil? && allow_null == false && !default . nil?
241241 do_execute ( "UPDATE #{ table_id } SET #{ column_id } =#{ quote ( default ) } WHERE #{ column_id } IS NULL" )
242242 end
243- sql = "ALTER TABLE #{ table_id } ALTER COLUMN #{ column_id } #{ type_to_sql column . type , column . limit , column . precision , column . scale } "
243+ sql = "ALTER TABLE #{ table_id } ALTER COLUMN #{ column_id } #{ type_to_sql column . type , limit : column . limit , precision : column . precision , scale : column . scale } "
244244 sql << ' NOT NULL' if !allow_null . nil? && allow_null == false
245245 do_execute sql
246246 end
0 commit comments