diff --git a/README.md b/README.md index ba13411..f669437 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,18 @@ Arel::Nodes::InfixOperation.new( Run tests in this repository with `rake`. Migrations are exercised by running them in the dummy application. ``` +bundle install +cd test/dummy +rm -f db/schema.rb && RAILS_ENV=test bundle exec rake db:drop db:create db:migrate +cd ../../ +bundle exec rake +``` + +If you also want to verify running tests on Rails Edge, you can set `BUNDLE_GEMFILE` and run everything again. Otherwise could technically also rely on GitHub Actions to run this for you. + +``` +export BUNDLE_GEMFILE=$(pwd)/Gemfile.edge +bundle install cd test/dummy rm -f db/schema.rb && RAILS_ENV=test bundle exec rake db:drop db:create db:migrate cd ../../ diff --git a/lib/active_record/collation/schema_statements.rb b/lib/active_record/collation/schema_statements.rb index c266e77..2f8fe85 100644 --- a/lib/active_record/collation/schema_statements.rb +++ b/lib/active_record/collation/schema_statements.rb @@ -18,7 +18,7 @@ def drop_collation(name) end def collations - internal_exec_query(collations_sql, 'SCHEMA') + select_all(collations_sql, 'SCHEMA') end private diff --git a/test/active_record/collation/schema_statements_test.rb b/test/active_record/collation/schema_statements_test.rb index 738cd8f..1733ef8 100644 --- a/test/active_record/collation/schema_statements_test.rb +++ b/test/active_record/collation/schema_statements_test.rb @@ -18,6 +18,20 @@ def collation_names ApplicationRecord.connection.drop_collation(:misc) assert_equal_set(%w[natural_de natural_en], collation_names) end + + test 'notifies internals about the executed queries' do + queries = [] + callback = ->(event) { queries << event.payload[:sql] } + + ActiveSupport::Notifications.subscribed(callback, 'sql.active_record') do + collation_names + end + + assert_includes( + queries.last, + "pg_namespace.nspname = 'public'" + ) + end end end end