From 9a9989bfb5c70d8dd6855833545e8452b0beabe2 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Sun, 22 Mar 2020 20:47:30 +0800 Subject: [PATCH 1/4] Rescuing ActiveRecord::NoDatabaseError when dropping tenants --- lib/tasks/apartment.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/apartment.rake b/lib/tasks/apartment.rake index 437deda7..d8353821 100644 --- a/lib/tasks/apartment.rake +++ b/lib/tasks/apartment.rake @@ -22,7 +22,7 @@ apartment_namespace = namespace :apartment do begin puts("Dropping #{tenant} tenant") Apartment::Tenant.drop(tenant) - rescue Apartment::TenantNotFound => e + rescue Apartment::TenantNotFound, ActiveRecord::NoDatabaseError => e puts e.message end end From 5932fa03a454f8f83c591172dcb6054ae890710c Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Sun, 22 Mar 2020 22:34:37 +0800 Subject: [PATCH 2/4] Update 9.1.8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3fe43feb..b472b921 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: ruby services: - docker rvm: - - jruby-9.1.17.0 + - jruby-9.1.8 - 2.1.9 - 2.2.9 - 2.3.6 From 142bb9e69cf563f87db16153c3d8aded32650269 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Sun, 22 Mar 2020 22:38:25 +0800 Subject: [PATCH 3/4] Removed rubocop --- lib/apartment/railtie.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/apartment/railtie.rb b/lib/apartment/railtie.rb index e082ab9e..255f6273 100644 --- a/lib/apartment/railtie.rb +++ b/lib/apartment/railtie.rb @@ -34,7 +34,6 @@ class Railtie < Rails::Railtie Apartment.connection_class.connection_pool.with_connection do Apartment::Tenant.init end - # rubocop:disable Lint/SuppressedException rescue ::ActiveRecord::NoDatabaseError, PG::ConnectionBad # Since `db:create` and other tasks invoke this block from Rails 5.2.0, # we need to swallow the error to execute `db:create` properly. @@ -42,7 +41,6 @@ class Railtie < Rails::Railtie 'Failed to initialize Apartment because a database connection could not be established.' end end - # rubocop:enable Lint/SuppressedException end # From 4288ed218008799c1893e8a905cc71315a7734bb Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Sun, 22 Mar 2020 22:46:57 +0800 Subject: [PATCH 4/4] Upgrade jruby version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b472b921..d39c2375 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: ruby services: - docker rvm: - - jruby-9.1.8 + - jruby-9.2.11.0 - 2.1.9 - 2.2.9 - 2.3.6