-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move CI to Github Actions, update Rubocop, fix Jruby tests #251
Move CI to Github Actions, update Rubocop, fix Jruby tests #251
Conversation
and Remove circle CI
cb9246c
to
c8fb3fb
Compare
@@ -8,6 +8,8 @@ | |||
module Apartment::PostgreSqlAdapterPatch | |||
def default_sequence_name(table, _column) | |||
res = super | |||
res.delete!('"') # if rescued in super_method, trim leading and trailing quotes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont love this as a fix for the failing jruby/postgres test.
The test was raising this error:
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: relation "db3.companies" does not exist
from arjdbc/jdbc/RubyJdbcConnection.java:1082:in `execute_query'
and being caught in the rescue block here:
https://github.com/jruby/activerecord-jdbc-adapter/blob/master/lib/arjdbc/postgresql/adapter.rb#L482-L484
If this is a data/setup issue for the jruby postgres tests, fixing the test setup would be more ideal. If this is a behavior issue with the jdbc driver, then this is more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the cleaner way would have been to:
From e76a571502caf6b06fc8ca6163d66013151455be Mon Sep 17 00:00:00 2001
From: Matt Pasquini <matt.pasquini@coupa.com>
Date: Tue, 14 May 2024 09:45:08 -0700
Subject: [PATCH] Move postgres jdbc fix to jdbc adapter
---
lib/apartment/active_record/postgresql_adapter.rb | 1 -
lib/apartment/adapters/jdbc_postgresql_adapter.rb | 4 ++++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/apartment/active_record/postgresql_adapter.rb b/lib/apartment/active_record/postgresql_adapter.rb
index 5426840..48526f1 100644
--- a/lib/apartment/active_record/postgresql_adapter.rb
+++ b/lib/apartment/active_record/postgresql_adapter.rb
@@ -8,7 +8,6 @@
module Apartment::PostgreSqlAdapterPatch
def default_sequence_name(table, _column)
res = super
- res.delete!('"') # if rescued in super_method, trim leading and trailing quotes
schema_prefix = "#{Apartment::Tenant.current}."
default_tenant_prefix = "#{Apartment::Tenant.default_tenant}."
diff --git a/lib/apartment/adapters/jdbc_postgresql_adapter.rb b/lib/apartment/adapters/jdbc_postgresql_adapter.rb
index 3e9494b..5fe245d 100644
--- a/lib/apartment/adapters/jdbc_postgresql_adapter.rb
+++ b/lib/apartment/adapters/jdbc_postgresql_adapter.rb
@@ -17,6 +17,10 @@ module Apartment
module Adapters
# Default adapter when not using Postgresql Schemas
class JDBCPostgresqlAdapter < PostgresqlAdapter
+ def default_sequence_name
+ super.delete('"') # jdbc postgres adds quotes if rescued, trim leading and trailing quotes
+ end
+
private
def multi_tenantify_with_tenant_db_name(config, tenant)
--
2.37.3
Thought I dont think what is merged will cause any issue or regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still add that. I do like it better
Silence jdbc mysql driver warning
strip leading and trailing quotes from default_sequence_name override for Postgre adapter.
c8fb3fb
to
e5bc396
Compare
thank you so much @IanMcNelly, @mrpasquini, @andyundso for working on this! I really appreciate your efforts |
Ruby 3, 3.1, 3.2, 3.3, jruby
*Rails 6.1, 7.0, 7.1