- Drop support for Ruby 2.2, 2.3 and 2.4
- End support for upcoming ActiveRecord >= v6.1
- Drop Ruby 2.0.0 and 2.1 support
- Add
AR::Base#with_readonly
andAR::Base#with_writable
- short-hand for
AR::Base.with_readonly
andAR::Base.with_writable
- short-hand for
- Add
AR::Base#transaction_with
- short-hand for
AR::Base.transaction_with
- short-hand for
- Fix warnings for Rails 5.0
Model.with_readonly
andModel.with_writable
now raises error when the Model doesn't use switch_point
- Add
SwitchPoint::QueryCache
middleware Model.cache
andModel.uncached
is now hooked by switch_pointModel.cache
enables query cache for both readonly and writable.Model.uncached
disables query cache for both readonly and writable.
- Add
SwitchPoint.with_readonly_all
andSwitchPoint.with_writable_all
as shorthand
- Rename
SwitchPoint.with_connection
toSwitchPoint.with_mode
- To avoid confusion with
ActiveRecord::ConnectionPool#with_connection
- To avoid confusion with
- Inherit superclass' switch_point configuration
- Memorize switch_point config to ConnectionSpecification#config instead of ConnectionPool
- To support multi-threaded environment since Rails 4.0.
- Add Model.transaction_with method (#2, @ryopeko)
- Establish connection lazily
- Just like ActiveRecord::Base, real connection isn't created until
.connection
is called
- Just like ActiveRecord::Base, real connection isn't created until
- Support :writable only configuration
- auto_writable is disabled by default
- To restore the previous behavior, set
config.auto_writable = true
.
- To restore the previous behavior, set
- Add shorthand methods
SwitchPoint.with_readonly
,SwitchPoint.with_writable
- Support defaulting to writable ActiveRecord::Base connection
- When
:writable
key is omitted, ActiveRecord::Base is used for the writable connection.
- When
- Improve thread safety
- Raise appropriate error if unknown mode is given to with_connection
- Support specifying the same database name within different switch_point
- Add Proxy#readonly? and Proxy#writable? predicate
- Fix nil error on with_{readonly,writable} from non-switch_point model
- Add Proxy#switch_name to switch proxy configuration
- Fix weird nil error when Config#define_switch_point isn't called yet
- Always send destructive operations to writable connection
- Fix bug on pooled connections
- Initial release