oracle-enhanced icon indicating copy to clipboard operation
oracle-enhanced copied to clipboard

Support Rails 8.0

Open andynu opened this issue 10 months ago • 10 comments

Building on top of #2424 this adds support for existing oracle_enhanced functionality to Rails 8.0. It may not fully support new Rails 8.0 features; For example there seems to be retry logic in rails now, and the oracle enhanced adapter is still doing its own thing.

  • Add write_query? implementation (mimicking postgres) to support the ability to prevent writes to a database - https://github.com/rails/rails/commit/f39d72d5267baed1000932831cda98503d1e1047

  • Replace the local implementation of execute, exec_query and its alias internal_exec_query with the new interface defined here https://github.com/rails/rails/commit/fd24e5bfc9540fc00764a59ddf39a993bbd63ba2 of raw_execute, cast_result, and affected_rows. To support the affected_rows count this also had to add a row_count method to the coi and jdbc cursors.

  • without_prepared_statement? was removed https://github.com/rails/rails/commit/2306c10e7a9397f8096e49def97ed47125a4499f

Fixes #2419

andynu avatar Feb 24 '25 02:02 andynu

Yes! Thank you.

On Tue, Mar 11, 2025 at 12:15 PM DanielClarke750 @.***> wrote:

@.**** commented on this pull request.

In activerecord-oracle_enhanced-adapter.gemspec https://github.com/rsim/oracle-enhanced/pull/2425#discussion_r1989663638 :

@@ -26,7 +26,7 @@ This adapter is superset of original ActiveRecord Oracle adapter. "rubygems_mfa_required" => "true" }

  • s.add_runtime_dependency("activerecord", ["~> 7.1.0"])
  • s.add_runtime_dependency("activerecord", ["~> 7.2.0"])

Should this be bumped up to 8.0?

— Reply to this email directly, view it on GitHub https://github.com/rsim/oracle-enhanced/pull/2425#pullrequestreview-2675271981, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAONGMKCRALSMVBQT6OQF32T4DZVAVCNFSM6AAAAABXW7IN5GVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMNZVGI3TCOJYGE . You are receiving this because you authored the thread.Message ID: @.***>

andynu avatar Mar 11 '25 18:03 andynu

The VERSION should change too, but I'm not sure at what point in the PR process that is most appropriate.

andynu avatar Mar 11 '25 18:03 andynu

File dbms_output.rb, line 35

instrumenter .instrument(

must be

@instrumenter .instrument(

MrTheBino avatar Mar 13 '25 12:03 MrTheBino

That is how it used to be. But it appeared to have moved. Did it move back since?

From the commit: Use the instrumenter method.

@instrumenter is not defined. It was moved to a method.

https://github.com/rails/rails/commit/dc522a3e6933e014c691e06c5d866d6351d6640d

andynu avatar Mar 13 '25 12:03 andynu

rails/rails@dc522a3

This patch was only mentioned in the 8.0.2 changelog

I've tested this branch in 8.0.2 and found no issues. The only issue was the absence of the instrumenter method in 8.0.1.

hss-mateus avatar Mar 18 '25 13:03 hss-mateus

@andynu @rsim -- Is there anything that I can help with to get this issue closed at Rails 8 supported? I don't want to redo any work that's been done, but getting this completed would be super helpful for a client.

I'm glad to do any development or testing that would be helpful!

chernesk avatar May 13 '25 19:05 chernesk

🤷 I don't have keys to this kingdom either. I'd love for this project to continue, but I'm not sure how to accomplish that beyond the PRs.

andynu avatar May 13 '25 21:05 andynu

@rsim Is there anything that I can do to assist? I'm glad to help in any way that I can.

chernesk avatar May 14 '25 15:05 chernesk

@rsim One more comment. The latest Rails that this gem is compatible with is 7.1 which has reached end of active support and will reach the end of security support in four months.

https://endoflife.date/rails image

I'm here to help in any way that I can.

chernesk avatar May 14 '25 15:05 chernesk

@andynu @rsim -- Is there anything that I can help with to get this issue closed at Rails 8 supported? I don't want to redo any work that's been done, but getting this completed would be super helpful for a client.

I'm glad to do any development or testing that would be helpful!

@yahonda As the last person to release a new version of this gem, I assume you might be the right person to ask? Is there anything we can do to help get this released?

ddalcino avatar May 14 '25 22:05 ddalcino

@yahonda Really appreciate the 7.1.1 release.

Anything I can help with to move this issue forward?

chernesk avatar Jun 17 '25 23:06 chernesk

Would you rebase master branch?

yahonda avatar Jun 18 '25 04:06 yahonda

fork synced. git rebase -ff origin/master complete.

andynu avatar Jun 18 '25 12:06 andynu

Could you address these RuboCop offenses and rebase onto the master branch? I'd like the RuboCop offense fixes to be included in the original commits, rather than seeing separate commits just for fixing RuboCop offenses.

https://github.com/rsim/oracle-enhanced/actions/runs/15732983575/job/44338346523?pr=2425

lib/active_record/connection_adapters/oracle_enhanced/context_index.rb:334:1: C: [Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/active_record/connection_adapters/oracle_enhanced/context_index.rb:337:17: C: [Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
                'CONTAINS',
                ^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/context_index.rb:344:1: C: [Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/active_record/connection_adapters/oracle_enhanced/context_index.rb:346:99: C: [Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
              condition = Arel::Nodes::GreaterThan.new(contains_node, Arel::Nodes::SqlLiteral.new('0'))
                                                                                                  ^^^
lib/active_record/connection_adapters/oracle_enhanced/context_index.rb:347:1: C: [Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:66:1: C: [Correctable] Layout/EmptyLines: Extra blank line detected.

yahonda avatar Jun 20 '25 07:06 yahonda

Certainly. rubocop -a, and rebased.

andynu avatar Jun 20 '25 13:06 andynu