Skip to content

Commit c1e1db1

Browse files
committed
Clear the schema cache for a table after creating it to prevent a cached negative response - fixes test ActiveRecord::Migration::ChangeSchemaTest#test_change_column_null
1 parent be71de1 commit c1e1db1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ def table_exists?(table_name)
1616
super || tables.include?(unquoted_table_name) || views.include?(unquoted_table_name)
1717
end
1818

19+
def create_table(table_name, options = {})
20+
res = super
21+
schema_cache.clear_table_cache!(table_name)
22+
res
23+
end
24+
1925
def indexes(table_name, name = nil)
2026
data = select("EXEC sp_helpindex #{quote(table_name)}", name) rescue []
2127
data.reduce([]) do |indexes, index|

0 commit comments

Comments
 (0)