@@ -61,12 +61,14 @@ def setup
61
61
Thing . lease_connection . drop_table ( table ) rescue nil
62
62
end
63
63
Thing . reset_column_information
64
+ clear_statement_cache ( Thing )
64
65
65
66
%w( reminders people_reminders prefix_reminders_suffix ) . each do |table |
66
67
Reminder . lease_connection . drop_table ( table ) rescue nil
67
68
end
68
69
Reminder . reset_table_name
69
70
Reminder . reset_column_information
71
+ clear_statement_cache ( Reminder )
70
72
71
73
%w( last_name key bio age height wealth birthday favorite_day
72
74
moment_of_truth male administrator funny ) . each do |column |
@@ -76,6 +78,7 @@ def setup
76
78
Person . lease_connection . remove_column ( "people" , "middle_name" ) rescue nil
77
79
Person . lease_connection . add_column ( "people" , "first_name" , :string )
78
80
Person . reset_column_information
81
+ clear_statement_cache ( Person )
79
82
80
83
ActiveRecord ::Migration . verbose = @verbose_was
81
84
end
@@ -1131,6 +1134,12 @@ def self.base_class; self; end
1131
1134
}
1132
1135
end
1133
1136
1137
+ def clear_statement_cache ( model )
1138
+ model . connection_handler . each_connection_pool do |pool |
1139
+ pool . connections . each ( &:clear_cache! )
1140
+ end
1141
+ end
1142
+
1134
1143
def with_another_process_holding_lock ( lock_id )
1135
1144
thread_lock = Concurrent ::CountDownLatch . new
1136
1145
test_terminated = Concurrent ::CountDownLatch . new
0 commit comments