Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../../
Expand Down
2 changes: 1 addition & 1 deletion lib/active_record/collation/schema_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def drop_collation(name)
end

def collations
internal_exec_query(collations_sql, 'SCHEMA')
select_all(collations_sql, 'SCHEMA')
end

private
Expand Down
14 changes: 14 additions & 0 deletions test/active_record/collation/schema_statements_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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