mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 23:48:44 +08:00
DEV: Fix reloading type map not clearing cache (#25924)
Why this change? This is a follow up to 408d2f8e692868779b1b05c19fcb32c35897184b. When `ActiveRecord::ConnectionAdapaters::PostgreSQLAdatper#reload_type_map` is called, we need to clear the type map cache otherwise migrations adding an array column will end up throwing errors.
This commit is contained in:

committed by
GitHub

parent
408d2f8e69
commit
1a44c359b9
@ -14,7 +14,10 @@ RSpec.describe "Caching PostgreSQL connection type map" do
|
||||
end
|
||||
end
|
||||
|
||||
expect do ActiveRecord::Base.connection.reconnect! end.not_to change { pg_type_queries.length }
|
||||
expect do
|
||||
ActiveRecord::Base.clear_active_connections!
|
||||
ActiveRecord::Base.establish_connection
|
||||
end.to change { pg_type_queries.length }.by(1) # There is some default pg_type query but if stuff was not cached, we would see 4 queries here
|
||||
ensure
|
||||
ActiveSupport::Notifications.unsubscribe(subscriber)
|
||||
end
|
||||
|
Reference in New Issue
Block a user