ActiveContext: reload on change and other minor updates
What does this MR do and why?
Adds two new methods:
-
collection.name_without_prefix: needed for running thedrop_collectionmigration inline -
connection.adapterwhich can be run using an active or inactive connection. This is needed to run cleanup if a connection is deactivated.
Also reloads the adapter when a connection is saved. This is to ensure we always use the adapter with the right connection and options.
References
- [ActiveContext Code] Add button to disable sema... (#582787)
- ActiveContext: invalidate current adapter activ... (#521434)
How to set up and validate locally
- Create a connection, activate it and run migrations
- Test that
ActiveContext.adapter.connection.collections.first.name_without_prefixiscode - Test that
connection.adapterreturns the right adapter and options - Deactivate the connection:
connection.deactivate! - Test that
connection.adapterstill returns the right adapter and options - Create a new connection and activate it
- Test that
ActiveContext.adapter.connectionis the new connection
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.