Skip to content

Commit 5beb062

Browse files
Merge pull request rails#48012 from fatkodima/mysql-adapter-load-hook
Add load hook for `ActiveRecord::ConnectionAdapters::Mysql2Adapter`
2 parents 161badb + 00b8ce6 commit 5beb062

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

activerecord/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
* Add a load hook for `ActiveRecord::ConnectionAdapters::Mysql2Adapter`
2+
(named `active_record_mysql2adapter`) to allow for overriding aspects of the
3+
`ActiveRecord::ConnectionAdapters::Mysql2Adapter` class. This makes `Mysql2Adapter`
4+
consistent with `PostgreSQLAdapter` and `SQLite3Adapter` that already have load hooks.
5+
6+
*fatkodima*
7+
18
* Introduce adapter for Trilogy database client
29

310
Trilogy is a MySQL-compatible database client. Rails applications can use Trilogy

activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,6 @@ def default_prepared_statements
179179
false
180180
end
181181
end
182+
ActiveSupport.run_load_hooks(:active_record_mysql2adapter, Mysql2Adapter)
182183
end
183184
end

guides/source/engines.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,9 @@ These are the load hooks you can use in your own code. To hook into the initiali
14951495
| `ActiveJob::TestCase` | `active_job_test_case` |
14961496
| `ActiveRecord::Base` | `active_record` |
14971497
| `ActiveRecord::TestFixtures` | `active_record_fixtures` |
1498+
| `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter` | `active_record_postgresqladapter` |
1499+
| `ActiveRecord::ConnectionAdapters::Mysql2Adapter` | `active_record_mysql2adapter` |
1500+
| `ActiveRecord::ConnectionAdapters::SQLite3Adapter` | `active_record_sqlite3adapter` |
14981501
| `ActiveStorage::Attachment` | `active_storage_attachment` |
14991502
| `ActiveStorage::VariantRecord` | `active_storage_variant_record` |
15001503
| `ActiveStorage::Blob` | `active_storage_blob` |

0 commit comments

Comments
 (0)