From 852208d91797ba34326e048991e9ea099a641913 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 17:50:12 +0900 Subject: [PATCH 01/18] Only support up to Rails 5 for now --- standby.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standby.gemspec b/standby.gemspec index b30de61..7da41f3 100644 --- a/standby.gemspec +++ b/standby.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.require_paths = ['lib'] gem.required_ruby_version = '>= 2.0' - gem.add_runtime_dependency 'activerecord', '>= 3.0.0' + gem.add_runtime_dependency 'activerecord', '>= 3.0.0', '< 6.0' gem.add_development_dependency 'rspec' gem.add_development_dependency 'sqlite3' From 561287a1d12f41e7987d472981f1b2f36dab1d25 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 17:52:26 +0900 Subject: [PATCH 02/18] Some more cleanup on slavery keyword --- slavery.gemspec | 27 ----------------------- spec/{slavery_spec.rb => standby_spec.rb} | 0 2 files changed, 27 deletions(-) delete mode 100644 slavery.gemspec rename spec/{slavery_spec.rb => standby_spec.rb} (100%) diff --git a/slavery.gemspec b/slavery.gemspec deleted file mode 100644 index c501acc..0000000 --- a/slavery.gemspec +++ /dev/null @@ -1,27 +0,0 @@ -# -*- encoding: utf-8 -*- -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'standby/version' - -Gem::Specification.new do |gem| - gem.post_install_message = 'The slavery gem has been deprecated and has ' \ - 'been replaced by standby. Please switch to ' \ - 'standby as soon as possible.' - gem.name = 'slavery' - gem.version = Standby::VERSION - gem.authors = ['Kenn Ejima'] - gem.email = ['kenn.ejima@gmail.com'] - gem.description = %q{Simple, conservative slave reads for ActiveRecord} - gem.summary = %q{Simple, conservative slave reads for ActiveRecord} - gem.homepage = 'https://github.com/kenn/slavery' - - gem.files = `git ls-files`.split($/) - gem.executables = gem.files.grep(%r{^exe/}).map{ |f| File.basename(f) } - gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) - gem.require_paths = ['lib'] - - gem.add_runtime_dependency 'activerecord', '>= 3.0.0' - - gem.add_development_dependency 'rspec' - gem.add_development_dependency 'sqlite3' -end diff --git a/spec/slavery_spec.rb b/spec/standby_spec.rb similarity index 100% rename from spec/slavery_spec.rb rename to spec/standby_spec.rb From 353fb8d26f814c24e6b37dc0c529f95bbbd2751b Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 18:11:08 +0900 Subject: [PATCH 03/18] Trying to fixate sqlite3 at 1.3 for older versions --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ gemfiles/rails3.2.gemfile | 5 +++-- gemfiles/rails4.2.gemfile | 6 +++++- gemfiles/rails5.2.gemfile | 4 ++-- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..18d9800 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: ci +on: [pull_request, push] + +jobs: + test: + strategy: + fail-fast: false + matrix: + ruby: + - "2.7" + - "2.6" + rails_version: + - "5.2" + - "4.2" + - "3.2" + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails_version }}.gemfile + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + bundler: ${{ matrix.bundler }} + ruby-version: ${{ matrix.ruby }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - run: bundle exec rake diff --git a/gemfiles/rails3.2.gemfile b/gemfiles/rails3.2.gemfile index 9cca270..2da41cc 100644 --- a/gemfiles/rails3.2.gemfile +++ b/gemfiles/rails3.2.gemfile @@ -1,9 +1,10 @@ source "https://rubygems.org" +gemspec name: 'standby', path: '../' + gem 'activerecord', '~> 3.2' group :development, :test do + gem 'sqlite3', '~> 1.3.6' gem 'test-unit', '~> 3.0' end - -gemspec name: 'standby', path: '../' diff --git a/gemfiles/rails4.2.gemfile b/gemfiles/rails4.2.gemfile index 1780190..4650f73 100644 --- a/gemfiles/rails4.2.gemfile +++ b/gemfiles/rails4.2.gemfile @@ -1,5 +1,9 @@ source "https://rubygems.org" +gemspec name: 'standby', path: '../' + gem 'activerecord', '~> 4.2' -gemspec name: 'standby', path: '../' +group :development, :test do + gem 'sqlite3', '~> 1.3.6' +end diff --git a/gemfiles/rails5.2.gemfile b/gemfiles/rails5.2.gemfile index ee418aa..61e8d89 100644 --- a/gemfiles/rails5.2.gemfile +++ b/gemfiles/rails5.2.gemfile @@ -1,5 +1,5 @@ source "https://rubygems.org" -gem 'activerecord', '~> 5.2' - gemspec name: 'standby', path: '../' + +gem 'activerecord', '~> 5.2' From b4f9553bbc088b4a72b10ab9a73d32154adda9b3 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 18:16:15 +0900 Subject: [PATCH 04/18] Adding rake to gemspec --- standby.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/standby.gemspec b/standby.gemspec index 7da41f3..de29fa3 100644 --- a/standby.gemspec +++ b/standby.gemspec @@ -20,6 +20,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'activerecord', '>= 3.0.0', '< 6.0' + gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec' gem.add_development_dependency 'sqlite3' end From 1161da30ea3c914bf4ce97480aeae9996292eec4 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 18:27:04 +0900 Subject: [PATCH 05/18] Downgrade supported ruby versions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18d9800..d6f9bdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,8 @@ jobs: fail-fast: false matrix: ruby: - - "2.7" - - "2.6" + - "2.5" + - "2.2" rails_version: - "5.2" - "4.2" From 07d67daac0596f315f4b2c0a888efbf0b9364c44 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 18:33:42 +0900 Subject: [PATCH 06/18] Drop support for Rails 3.x --- .github/workflows/ci.yml | 1 - gemfiles/rails3.2.gemfile | 10 ---------- 2 files changed, 11 deletions(-) delete mode 100644 gemfiles/rails3.2.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6f9bdd..5435fbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,6 @@ jobs: rails_version: - "5.2" - "4.2" - - "3.2" runs-on: ubuntu-latest env: BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails_version }}.gemfile diff --git a/gemfiles/rails3.2.gemfile b/gemfiles/rails3.2.gemfile deleted file mode 100644 index 2da41cc..0000000 --- a/gemfiles/rails3.2.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -source "https://rubygems.org" - -gemspec name: 'standby', path: '../' - -gem 'activerecord', '~> 3.2' - -group :development, :test do - gem 'sqlite3', '~> 1.3.6' - gem 'test-unit', '~> 3.0' -end From 64356b085b54b24b151bdc5beeb47959eabc65e5 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Wed, 10 Aug 2022 18:36:27 +0900 Subject: [PATCH 07/18] Remove travil.yml --- .travis.yml | 14 -------------- README.md | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ddc72f1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: ruby - -matrix: - include: - - rvm: ruby-head - gemfile: Gemfile - - rvm: 2.5 - gemfile: gemfiles/rails5.2.gemfile - - rvm: 2.5 - gemfile: gemfiles/rails4.2.gemfile - - rvm: 2.2 - gemfile: gemfiles/rails3.2.gemfile - -script: bundle exec rspec spec diff --git a/README.md b/README.md index 7606a73..567910a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Standby - Read from standby databases for ActiveRecord (formerly Slavery) -[![Build Status](https://travis-ci.org/kenn/standby.svg)](https://travis-ci.org/kenn/standby) +![Build Status](https://github.com/kenn/standby/actions/workflows/ci.yml/badge.svg) Standby is a simple, easy to use gem for ActiveRecord that enables conservative reading from standby databases, which means it won't automatically redirect all SELECTs to standbys. From d76c66e611dd1f9b5a77d0c5f44176cd9ce230f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20S=CC=8Cpa=CC=81nik?= Date: Tue, 28 Mar 2023 18:04:22 +0200 Subject: [PATCH 08/18] Fix ActiveRecord::Base.configurations for rails 7 --- gemfiles/rails7.0.gemfile | 5 +++++ lib/standby/connection_holder.rb | 8 +++++--- spec/configuration_spec.rb | 8 +++++--- standby.gemspec | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 gemfiles/rails7.0.gemfile diff --git a/gemfiles/rails7.0.gemfile b/gemfiles/rails7.0.gemfile new file mode 100644 index 0000000..41dc24d --- /dev/null +++ b/gemfiles/rails7.0.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gemspec name: 'standby', path: '../' + +gem 'activerecord', '~> 7.0' \ No newline at end of file diff --git a/lib/standby/connection_holder.rb b/lib/standby/connection_holder.rb index 5b2a31e..cd8cc6e 100644 --- a/lib/standby/connection_holder.rb +++ b/lib/standby/connection_holder.rb @@ -5,8 +5,10 @@ class ConnectionHolder < ActiveRecord::Base class << self # for delayed activation def activate(target) - spec = ActiveRecord::Base.configurations["#{ActiveRecord::ConnectionHandling::RAILS_ENV.call}_#{target}"] - raise Error.new("Standby target '#{target}' is invalid!") if spec.nil? + env_name = "#{ActiveRecord::ConnectionHandling::RAILS_ENV.call}_#{target}" + spec = ActiveRecord::Base.configurations.find_db_config(env_name)&.configuration_hash + raise Error, "Standby target '#{target}' is invalid!" if spec.nil? + establish_connection spec end end @@ -25,4 +27,4 @@ def connection_holder(target) end end end -end +end \ No newline at end of file diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 81d39c1..6676e45 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -4,7 +4,9 @@ before do # Backup connection and configs @backup_conn = Standby.instance_variable_get :@standby_connections - @backup_config = ActiveRecord::Base.configurations.dup + @backup_config = ActiveRecord::Base.configurations.configs_for.map do |config| + [config.env_name, config.configuration_hash] + end.to_h @backup_disabled = Standby.disabled @backup_conn.each_key do |klass_name| Object.send(:remove_const, klass_name) if Object.const_defined?(klass_name) @@ -20,13 +22,13 @@ end it 'raises error if standby configuration not specified' do - ActiveRecord::Base.configurations['test_standby'] = nil + ActiveRecord::Base.configurations = @backup_config.merge({ 'test_standby' => {} }) expect { Standby.on_standby { User.count } }.to raise_error(Standby::Error) end it 'connects to primary if standby configuration is disabled' do - ActiveRecord::Base.configurations['test_standby'] = nil + ActiveRecord::Base.configurations = @backup_config.merge({ 'test_standby' => {} }) Standby.disabled = true expect(Standby.on_standby { User.count }).to be 2 diff --git a/standby.gemspec b/standby.gemspec index de29fa3..2dcc61c 100644 --- a/standby.gemspec +++ b/standby.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.require_paths = ['lib'] gem.required_ruby_version = '>= 2.0' - gem.add_runtime_dependency 'activerecord', '>= 3.0.0', '< 6.0' + gem.add_runtime_dependency 'activerecord', '>= 3.0.0', '< 8.0' gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec' From 7b6968d60eb5c4bdfa2d24c8df68e55a771ff7b9 Mon Sep 17 00:00:00 2001 From: Doug Edey Date: Fri, 3 Nov 2023 15:41:14 -0400 Subject: [PATCH 09/18] For Rails 7.1 or above, use the named bold param --- lib/standby/active_record/log_subscriber.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/standby/active_record/log_subscriber.rb b/lib/standby/active_record/log_subscriber.rb index 7cfe1e1..aa5a52e 100644 --- a/lib/standby/active_record/log_subscriber.rb +++ b/lib/standby/active_record/log_subscriber.rb @@ -4,9 +4,16 @@ class LogSubscriber alias_method :debug_without_standby, :debug def debug(msg) - db = Standby.disabled ? "" : color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true) + db = Standby.disabled ? "" : log_header debug_without_standby(db + msg) end + def log_header + if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}".to_f >= 7.1 + color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, bold: true) + else + color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true) + end + end end end From 48cf8d1b4e6bb1964a84d7730588ef10a755f23a Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Sat, 4 Nov 2023 18:23:04 +0900 Subject: [PATCH 10/18] Fix with ActiveRecord.version --- .github/workflows/ci.yml | 4 +++- .gitignore | 5 +---- lib/standby/active_record/log_subscriber.rb | 2 +- spec/spec_helper.rb | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5435fbf..f5e234e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,10 +8,12 @@ jobs: matrix: ruby: - "2.5" - - "2.2" rails_version: + - "7.1" - "5.2" - "4.2" + bundler: + - "1.17.3" runs-on: ubuntu-latest env: BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails_version }}.gemfile diff --git a/.gitignore b/.gitignore index 3824558..1cd20de 100644 --- a/.gitignore +++ b/.gitignore @@ -12,11 +12,8 @@ doc/ lib/bundler/man pkg rdoc +spec/db spec/reports test/tmp test/version_tmp tmp - -test_db -test_standby_one -test_standby_two diff --git a/lib/standby/active_record/log_subscriber.rb b/lib/standby/active_record/log_subscriber.rb index aa5a52e..8d2de13 100644 --- a/lib/standby/active_record/log_subscriber.rb +++ b/lib/standby/active_record/log_subscriber.rb @@ -9,7 +9,7 @@ def debug(msg) end def log_header - if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}".to_f >= 7.1 + if Gem::Version.new(ActiveRecord.version) >= Gem::Version.new('7.1') color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, bold: true) else color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b77be9b..c327758 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,9 +6,9 @@ require 'standby' ActiveRecord::Base.configurations = { - 'test' => { 'adapter' => 'sqlite3', 'database' => 'test_db' }, - 'test_standby' => { 'adapter' => 'sqlite3', 'database' => 'test_standby_one' }, - 'test_standby_two' => { 'adapter' => 'sqlite3', 'database' => 'test_standby_two'}, + 'test' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_db' }, + 'test_standby' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_standby_one' }, + 'test_standby_two' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_standby_two'}, 'test_standby_url' => 'postgres://root:@localhost:5432/test_standby' } From 973ec88ad54739801724b1866b89aac02e28b92b Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Sat, 4 Nov 2023 18:24:56 +0900 Subject: [PATCH 11/18] 7.0 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5e234e..ca7da82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: ruby: - "2.5" rails_version: - - "7.1" + - "7.0" - "5.2" - "4.2" bundler: From fff1006e2dbdf605d30b79de319c1a964f7b80db Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Sat, 4 Nov 2023 18:28:11 +0900 Subject: [PATCH 12/18] Fix more --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca7da82..8969d6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,13 +7,11 @@ jobs: fail-fast: false matrix: ruby: - - "2.5" + - "2.7" rails_version: - "7.0" - "5.2" - "4.2" - bundler: - - "1.17.3" runs-on: ubuntu-latest env: BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails_version }}.gemfile @@ -21,7 +19,6 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - bundler: ${{ matrix.bundler }} ruby-version: ${{ matrix.ruby }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - run: bundle exec rake From 79c9c1129d8ba877614c2e90a0f8bb75be3e8368 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Sat, 4 Nov 2023 18:41:36 +0900 Subject: [PATCH 13/18] Old version support --- lib/standby/active_record/log_subscriber.rb | 6 ++++-- lib/standby/connection_holder.rb | 6 +++++- lib/standby/version.rb | 8 +++++++- spec/configuration_spec.rb | 22 ++++++++++++++++----- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lib/standby/active_record/log_subscriber.rb b/lib/standby/active_record/log_subscriber.rb index 8d2de13..d7e9515 100644 --- a/lib/standby/active_record/log_subscriber.rb +++ b/lib/standby/active_record/log_subscriber.rb @@ -1,15 +1,17 @@ +require 'standby/version' + module ActiveRecord class LogSubscriber alias_method :debug_without_standby, :debug def debug(msg) - db = Standby.disabled ? "" : log_header + db = Standby.disabled ? '' : log_header debug_without_standby(db + msg) end def log_header - if Gem::Version.new(ActiveRecord.version) >= Gem::Version.new('7.1') + if Standby.version_gte?('7.1') color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, bold: true) else color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true) diff --git a/lib/standby/connection_holder.rb b/lib/standby/connection_holder.rb index cd8cc6e..3dd487d 100644 --- a/lib/standby/connection_holder.rb +++ b/lib/standby/connection_holder.rb @@ -6,7 +6,11 @@ class << self # for delayed activation def activate(target) env_name = "#{ActiveRecord::ConnectionHandling::RAILS_ENV.call}_#{target}" - spec = ActiveRecord::Base.configurations.find_db_config(env_name)&.configuration_hash + if Standby.version_gte?('7.0') + spec = ActiveRecord::Base.configurations.find_db_config(env_name)&.configuration_hash + else + spec = ActiveRecord::Base.configurations[env_name] + end raise Error, "Standby target '#{target}' is invalid!" if spec.nil? establish_connection spec diff --git a/lib/standby/version.rb b/lib/standby/version.rb index 18ad2d1..f0d0bba 100644 --- a/lib/standby/version.rb +++ b/lib/standby/version.rb @@ -1,3 +1,9 @@ module Standby - VERSION = '6.0.0.pd.1' + VERSION = '4.0.0' + + class << self + def version_gte?(version) + Gem::Version.new(ActiveRecord.version) >= Gem::Version.new(version) + end + end end diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 6676e45..580cfe1 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -4,9 +4,13 @@ before do # Backup connection and configs @backup_conn = Standby.instance_variable_get :@standby_connections - @backup_config = ActiveRecord::Base.configurations.configs_for.map do |config| - [config.env_name, config.configuration_hash] - end.to_h + if Standby.version_gte?('7.0') + @backup_config = ActiveRecord::Base.configurations.configs_for.map do |config| + [config.env_name, config.configuration_hash] + end.to_h + else + @backup_config = ActiveRecord::Base.configurations.dup + end @backup_disabled = Standby.disabled @backup_conn.each_key do |klass_name| Object.send(:remove_const, klass_name) if Object.const_defined?(klass_name) @@ -22,13 +26,21 @@ end it 'raises error if standby configuration not specified' do - ActiveRecord::Base.configurations = @backup_config.merge({ 'test_standby' => {} }) + if Standby.version_gte?('7.0') + ActiveRecord::Base.configurations = @backup_config.merge({ 'test_standby' => {} }) + else + ActiveRecord::Base.configurations['test_standby'] = nil + end expect { Standby.on_standby { User.count } }.to raise_error(Standby::Error) end it 'connects to primary if standby configuration is disabled' do - ActiveRecord::Base.configurations = @backup_config.merge({ 'test_standby' => {} }) + if Standby.version_gte?('7.0') + ActiveRecord::Base.configurations = @backup_config.merge({ 'test_standby' => {} }) + else + ActiveRecord::Base.configurations['test_standby'] = nil + end Standby.disabled = true expect(Standby.on_standby { User.count }).to be 2 From b1d7db14156e52181c8bee853fac9ab3d151c1d6 Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Sat, 4 Nov 2023 18:42:58 +0900 Subject: [PATCH 14/18] Drop Rails 4.2 support --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8969d6e..708a799 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ jobs: rails_version: - "7.0" - "5.2" - - "4.2" runs-on: ubuntu-latest env: BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails_version }}.gemfile From a59912247a8443cf70f442d406ab349ee413cc8b Mon Sep 17 00:00:00 2001 From: Kenn Ejima Date: Sat, 4 Nov 2023 18:45:44 +0900 Subject: [PATCH 15/18] Support Rails 5 to 7 with v5.0 --- lib/standby/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/standby/version.rb b/lib/standby/version.rb index f0d0bba..3ed258c 100644 --- a/lib/standby/version.rb +++ b/lib/standby/version.rb @@ -1,5 +1,5 @@ module Standby - VERSION = '4.0.0' + VERSION = '5.0.0' class << self def version_gte?(version) From 6d95547a2b062be6e32681dd8c04760eda0c4f62 Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Thu, 4 Nov 2021 05:08:40 -0400 Subject: [PATCH 16/18] Release 5.0.0.pd.1 (#2) --- lib/standby/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/standby/version.rb b/lib/standby/version.rb index 3ed258c..bbc418d 100644 --- a/lib/standby/version.rb +++ b/lib/standby/version.rb @@ -1,5 +1,5 @@ module Standby - VERSION = '5.0.0' + VERSION = '5.0.0.pd.2' class << self def version_gte?(version) From c25175bdfb3ef0b39d6ab954183e10a00952d901 Mon Sep 17 00:00:00 2001 From: Adam Vaughan Date: Wed, 8 Dec 2021 09:30:00 -0700 Subject: [PATCH 17/18] Bump version to 6.0.0.pd.1 --- lib/standby/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/standby/version.rb b/lib/standby/version.rb index bbc418d..3f3f4f4 100644 --- a/lib/standby/version.rb +++ b/lib/standby/version.rb @@ -1,5 +1,5 @@ module Standby - VERSION = '5.0.0.pd.2' + VERSION = '6.0.0.pd.2' class << self def version_gte?(version) From 952614d6ec316d9cd168212ed6fcabb3c5fcf7b1 Mon Sep 17 00:00:00 2001 From: Rodrigo Merino Date: Tue, 6 Feb 2024 19:34:02 -0300 Subject: [PATCH 18/18] Rebasing against the upstream gem repository --- lib/standby/version.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/standby/version.rb b/lib/standby/version.rb index 3f3f4f4..da08a8b 100644 --- a/lib/standby/version.rb +++ b/lib/standby/version.rb @@ -1,6 +1,5 @@ module Standby VERSION = '6.0.0.pd.2' - class << self def version_gte?(version) Gem::Version.new(ActiveRecord.version) >= Gem::Version.new(version)