Skip to content

Commit b8a5454

Browse files
authored
Merge branch 'master' into rails-8-0-support
2 parents c0b12c4 + 1e7cb62 commit b8a5454

File tree

13 files changed

+121
-42
lines changed

13 files changed

+121
-42
lines changed

.github/workflows/rubocop.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,13 @@ jobs:
1010
build:
1111

1212
runs-on: ubuntu-latest
13-
14-
env:
15-
LD_LIBRARY_PATH: /opt/oracle/instantclient_23_6
16-
1713
steps:
1814
- uses: actions/checkout@v4
19-
- name: Set up Ruby 3.3
15+
- name: Set up Ruby 3.4
2016
uses: ruby/setup-ruby@v1
2117
with:
22-
ruby-version: 3.3
23-
- name: Download Oracle instant client
24-
run: |
25-
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-basic-linux.x64-23.6.0.24.10.zip
26-
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-sdk-linux.x64-23.6.0.24.10.zip
27-
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-sqlplus-linux.x64-23.6.0.24.10.zip
28-
- name: Install Oracle instant client
29-
run: |
30-
sudo unzip instantclient-basic-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
31-
sudo unzip -o instantclient-sdk-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
32-
sudo unzip -o instantclient-sqlplus-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
33-
echo "/opt/oracle/instantclient_23_6" >> $GITHUB_PATH
18+
ruby-version: 3.4
3419
- name: Build and run RuboCop
3520
run: |
36-
bundle install --jobs 4 --retry 3
37-
bundle exec rubocop
21+
BUNDLE_ONLY=rubocop bundle install --jobs 4 --retry 3
22+
BUNDLE_ONLY=rubocop bundle exec rubocop

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
'3.2',
2525
]
2626
env:
27-
ORACLE_HOME: /opt/oracle/instantclient_23_6
28-
LD_LIBRARY_PATH: /opt/oracle/instantclient_23_6
27+
ORACLE_HOME: /opt/oracle/instantclient_23_8
28+
LD_LIBRARY_PATH: /opt/oracle/instantclient_23_8
2929
NLS_LANG: AMERICAN_AMERICA.AL32UTF8
3030
TNS_ADMIN: ./ci/network/admin
3131
DATABASE_NAME: FREEPDB1
@@ -55,15 +55,15 @@ jobs:
5555
ruby-version: ${{ matrix.ruby }}
5656
- name: Download Oracle instant client
5757
run: |
58-
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-basic-linux.x64-23.6.0.24.10.zip
59-
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-sdk-linux.x64-23.6.0.24.10.zip
60-
wget -q https://download.oracle.com/otn_software/linux/instantclient/2360000/instantclient-sqlplus-linux.x64-23.6.0.24.10.zip
58+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-basic-linux.x64-23.8.0.25.04.zip
59+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sdk-linux.x64-23.8.0.25.04.zip
60+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sqlplus-linux.x64-23.8.0.25.04.zip
6161
- name: Install Oracle instant client
6262
run: |
63-
sudo unzip instantclient-basic-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
64-
sudo unzip -o instantclient-sdk-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
65-
sudo unzip -o instantclient-sqlplus-linux.x64-23.6.0.24.10.zip -d /opt/oracle/
66-
echo "/opt/oracle/instantclient_23_6" >> $GITHUB_PATH
63+
sudo unzip instantclient-basic-linux.x64-23.8.0.25.04.zip -d /opt/oracle/
64+
sudo unzip -o instantclient-sdk-linux.x64-23.8.0.25.04.zip -d /opt/oracle/
65+
sudo unzip -o instantclient-sqlplus-linux.x64-23.8.0.25.04.zip -d /opt/oracle/
66+
echo "/opt/oracle/instantclient_23_8" >> $GITHUB_PATH
6767
- name: Install JDBC Driver
6868
run: |
6969
wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/211/ojdbc11.jar -O ./lib/ojdbc11.jar
@@ -72,7 +72,7 @@ jobs:
7272
./ci/setup_accounts.sh
7373
- name: Update RubyGems
7474
run: |
75-
gem update --system || gem update --system 3.4.22
75+
gem update --system
7676
- name: Bundle install
7777
run: |
7878
bundle install --jobs 4 --retry 3

.rubocop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
require:
1+
plugins:
22
- rubocop-performance
33
- rubocop-rails
44
- rubocop-rspec
55

66
AllCops:
7-
TargetRubyVersion: 2.7
7+
TargetRubyVersion: 3.1
88
DisabledByDefault: true
99
SuggestExtensions: false
1010

Gemfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ group :development do
88
gem "rspec"
99
gem "rdoc"
1010
gem "rake"
11-
gem "rubocop", require: false
12-
gem "rubocop-performance", require: false
13-
gem "rubocop-rails", require: false
14-
gem "rubocop-rspec", require: false
15-
1611
gem "activerecord", github: "rails/rails", branch: "8-0-stable"
1712
gem "ruby-plsql", github: "rsim/ruby-plsql", branch: "master"
1813

@@ -26,3 +21,10 @@ group :development do
2621
gem "pry-nav"
2722
end
2823
end
24+
25+
group :rubocop do
26+
gem "rubocop", require: false
27+
gem "rubocop-performance", require: false
28+
gem "rubocop-rails", require: false
29+
gem "rubocop-rspec", require: false
30+
end

History.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## 7.2.0.rc1 / 2025-06-18
2+
3+
* Changes and bug fixes
4+
* Support Rails 7.2 [#2424]
5+
* Bump the minimum Ruby version to 3.1 [#2442]
6+
* Use RuboCop Plugin [#2427]
7+
* Use Oracle Instant Client Version 23.8
8+
9+
## 7.1.1 / 2025-06-16
10+
11+
* Changes and bug fixes
12+
* Address `add_timestamps` error [#2417, #2438]
13+
* Address `rename_table` ArgumentError [#2418, #2437]
14+
* Update `reconnect!` method signature [#2433, #2436]
15+
* Update README.md to support status of Rails 7.1 [#2408, #2409]
16+
117
## 7.1.0 / 2024-09-25
218

319
* Changes and bug fixes

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.0.alpha
1+
8.0.0.alpha

activerecord-oracle_enhanced-adapter.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
77
s.version = version
88

99
s.required_rubygems_version = ">= 1.8.11"
10-
s.required_ruby_version = ">= 2.7.0"
10+
s.required_ruby_version = ">= 3.1.0"
1111
s.license = "MIT"
1212
s.authors = ["Raimonds Simanovskis"]
1313
s.description = 'Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.

lib/active_record/connection_adapters/oracle_enhanced/quoting.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def self.mixed_case?(name)
107107
!!(object_name =~ /[A-Z]/ && object_name =~ /[a-z]/)
108108
end
109109

110-
111110
def quote_string(s) # :nodoc:
112111
s.gsub(/'/, "''")
113112
end

lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def primary_key(*args)
252252
rebuild_primary_key_index_to_default_tablespace(table_name, options)
253253
end
254254

255-
def rename_table(table_name, new_name) # :nodoc:
255+
def rename_table(table_name, new_name, **options) # :nodoc:
256256
if new_name.to_s.length > DatabaseLimits::IDENTIFIER_MAX_LENGTH
257257
raise ArgumentError, "New table name '#{new_name}' is too long; the limit is #{DatabaseLimits::IDENTIFIER_MAX_LENGTH} characters"
258258
end
@@ -261,7 +261,7 @@ def rename_table(table_name, new_name) # :nodoc:
261261
execute "RENAME #{quote_table_name(table_name)} TO #{quote_table_name(new_name)}"
262262
execute "RENAME #{quote_table_name("#{table_name}_seq")} TO #{default_sequence_name(new_name)}" rescue nil
263263

264-
rename_table_indexes(table_name, new_name)
264+
rename_table_indexes(table_name, new_name, **options)
265265
end
266266

267267
def drop_table(table_name, **options) # :nodoc:
@@ -622,6 +622,13 @@ def create_alter_table(name)
622622
OracleEnhanced::AlterTable.new create_table_definition(name)
623623
end
624624

625+
def add_timestamps(table_name, **options)
626+
fragments = add_timestamps_for_alter(table_name, **options)
627+
fragments.each do |fragment|
628+
execute "ALTER TABLE #{quote_table_name(table_name)} #{fragment}"
629+
end
630+
end
631+
625632
def update_table_definition(table_name, base)
626633
OracleEnhanced::Table.new(table_name, base)
627634
end

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def reconnect
452452
end
453453

454454
# Reconnects to the database.
455-
def reconnect! # :nodoc:
455+
def reconnect!(restore_transactions: false) # :nodoc:
456456
super
457457
_connection.reset!
458458
rescue OracleEnhanced::ConnectionException => e
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
describe "compatibility migrations" do
4+
include SchemaSpecHelper
5+
6+
before(:all) do
7+
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
8+
@conn = ActiveRecord::Base.connection
9+
schema_define do
10+
create_table :test_employees, force: true
11+
end
12+
end
13+
14+
after(:all) do
15+
schema_define do
16+
drop_table :test_employees, if_exists: true
17+
drop_table :new_test_employees, if_exists: true
18+
end
19+
end
20+
21+
it "should rename table on 7_0 and below" do
22+
migration = Class.new(ActiveRecord::Migration[7.0]) {
23+
def change
24+
rename_table :test_employees, :new_test_employees
25+
end
26+
}.new
27+
28+
migration.migrate(:up)
29+
expect(@conn.table_exists?(:new_test_employees)).to be_truthy
30+
expect(@conn.table_exists?(:test_employees)).not_to be_truthy
31+
32+
migration.migrate(:down)
33+
expect(@conn.table_exists?(:new_test_employees)).not_to be_truthy
34+
expect(@conn.table_exists?(:test_employees)).to be_truthy
35+
end
36+
end

spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
expect(ActiveRecord::Base.connection).to be_active
3131
end
3232

33+
it "should be active after reconnection to database with restore_transactions: true" do
34+
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
35+
ActiveRecord::Base.connection.reconnect!(restore_transactions: true)
36+
expect(ActiveRecord::Base.connection).to be_active
37+
end
38+
3339
it "should use database default cursor_sharing parameter value force by default" do
3440
# Use `SYSTEM_CONNECTION_PARAMS` to query v$parameter
3541
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS)

spec/active_record/connection_adapters/oracle_enhanced/schema_statements_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,34 @@ class ::TestEmployee < ActiveRecord::Base; end
387387
end
388388
end
389389

390+
describe "add timestamps" do
391+
before(:each) do
392+
@conn = ActiveRecord::Base.connection
393+
schema_define do
394+
create_table :test_employees, force: true
395+
end
396+
class ::TestEmployee < ActiveRecord::Base; end
397+
end
398+
399+
after(:each) do
400+
schema_define do
401+
drop_table :test_employees, if_exists: true
402+
end
403+
Object.send(:remove_const, "TestEmployee")
404+
ActiveRecord::Base.clear_cache!
405+
end
406+
407+
it "should add created_at and updated_at" do
408+
expect do
409+
@conn.add_timestamps("test_employees")
410+
end.not_to raise_error
411+
412+
TestEmployee.reset_column_information
413+
expect(TestEmployee.columns_hash["created_at"]).not_to be_nil
414+
expect(TestEmployee.columns_hash["updated_at"]).not_to be_nil
415+
end
416+
end
417+
390418
describe "ignore options for LOB columns" do
391419
after(:each) do
392420
schema_define do

0 commit comments

Comments
 (0)