Skip to content

Commit 3fdaa10

Browse files
Lairton Léliswpolicarpo
authored andcommitted
Make change_column_null use column_for instead of schema_cache
1 parent 229939b commit 3fdaa10

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def update_table_definition(table_name, base)
258258
def change_column_null(table_name, column_name, allow_null, default = nil)
259259
table_id = SQLServer::Utils.extract_identifiers(table_name)
260260
column_id = SQLServer::Utils.extract_identifiers(column_name)
261-
column = detect_column_for! table_name, column_name
261+
column = column_for(table_name, column_name)
262262
if !allow_null.nil? && allow_null == false && !default.nil?
263263
do_execute("UPDATE #{table_id} SET #{column_id}=#{quote(default)} WHERE #{column_id} IS NULL")
264264
end
@@ -492,13 +492,6 @@ def default_constraint_name(table_name, column_name)
492492
"DF_#{table_name}_#{column_name}"
493493
end
494494

495-
def detect_column_for!(table_name, column_name)
496-
unless column = schema_cache.columns(table_name).find { |c| c.name == column_name.to_s }
497-
raise ActiveRecordError, "No such column: #{table_name}.#{column_name}"
498-
end
499-
column
500-
end
501-
502495
def lowercase_schema_reflection_sql(node)
503496
lowercase_schema_reflection ? "LOWER(#{node})" : node
504497
end

0 commit comments

Comments
 (0)