activerecord-oracle_enhanced-adapter 7.1.0 → 7.2.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +16 -0
- data/README.md +11 -1
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +46 -48
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +10 -3
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +21 -17
- data/lib/arel/visitors/oracle.rb +0 -8
- data/lib/arel/visitors/oracle12.rb +0 -8
- data/lib/arel/visitors/oracle_common.rb +5 -0
- data/spec/active_record/connection_adapters/emulation/oracle_adapter_spec.rb +1 -1
- data/spec/active_record/connection_adapters/oracle_enhanced/compatibility_spec.rb +36 -0
- data/spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb +6 -0
- data/spec/active_record/connection_adapters/oracle_enhanced/database_tasks_spec.rb +2 -2
- data/spec/active_record/connection_adapters/oracle_enhanced/schema_dumper_spec.rb +1 -1
- data/spec/active_record/connection_adapters/oracle_enhanced/schema_statements_spec.rb +30 -3
- data/spec/active_record/connection_adapters/oracle_enhanced/structure_dump_spec.rb +3 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +6 -6
- data/spec/spec_helper.rb +2 -2
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92688a843f4614eaa882ff1d56ed98355a231e17910c40c4e987f5ab1e9f6af
|
4
|
+
data.tar.gz: ba50fcb6cf763090ee2738e68b61562b2d6647b19ef50e3686c6c050c2ca3f1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f00d84542ab4c54b6ab9b4af21b2ec48f06f7f2caaefe5a32dcf980e96978714c1d3dfe0b3bf2850d4176cc980fc3c4c832d711bae3b9232c1647dd4314f209
|
7
|
+
data.tar.gz: 9b43052d20dbb1fade82857876130514dc4743f24d798567eea233a7753f2ac27806a7d14356875e3336142880ce9502a2bcc8308117df5ef6cd40ffe9573062
|
data/History.md
CHANGED
@@ -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
|
+
|
1
17
|
## 7.1.0 / 2024-09-25
|
2
18
|
|
3
19
|
* Changes and bug fixes
|
data/README.md
CHANGED
@@ -6,10 +6,20 @@ Oracle enhanced adapter for ActiveRecord
|
|
6
6
|
DESCRIPTION
|
7
7
|
-----------
|
8
8
|
|
9
|
-
Oracle enhanced ActiveRecord adapter provides Oracle database access from Ruby on Rails applications. Oracle enhanced adapter can be used from Ruby on Rails versions between 2.3.x and 7.
|
9
|
+
Oracle enhanced ActiveRecord adapter provides Oracle database access from Ruby on Rails applications. Oracle enhanced adapter can be used from Ruby on Rails versions between 2.3.x and 7.1 and it is working with Oracle database versions 10g and higher
|
10
10
|
|
11
11
|
INSTALLATION
|
12
12
|
------------
|
13
|
+
### Rails 7.1
|
14
|
+
|
15
|
+
Oracle enhanced adapter version 7.1 supports Rails 7.1
|
16
|
+
When using Ruby on Rails version 7.1 then in Gemfile include
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# Use oracle as the database for Active Record
|
20
|
+
gem 'activerecord-oracle_enhanced-adapter', '~> 7.1.0'
|
21
|
+
```
|
22
|
+
|
13
23
|
### Rails 7.0
|
14
24
|
|
15
25
|
Oracle enhanced adapter version 7.0 supports Rails 7.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.2.0.rc1
|
@@ -4,19 +4,58 @@ module ActiveRecord
|
|
4
4
|
module ConnectionAdapters
|
5
5
|
module OracleEnhanced
|
6
6
|
module Quoting
|
7
|
+
extend ActiveSupport::Concern
|
7
8
|
# QUOTING ==================================================
|
8
9
|
#
|
9
10
|
# see: abstract/quoting.rb
|
10
11
|
QUOTED_COLUMN_NAMES = Concurrent::Map.new # :nodoc:
|
11
12
|
QUOTED_TABLE_NAMES = Concurrent::Map.new # :nodoc:
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
module ClassMethods # :nodoc:
|
15
|
+
def column_name_matcher
|
16
|
+
/
|
17
|
+
\A
|
18
|
+
(
|
19
|
+
(?:
|
20
|
+
# "table_name"."column_name" | function(one or no argument)
|
21
|
+
((?:\w+\.|"\w+"\.)?(?:\w+|"\w+") | \w+\((?:|\g<2>)\))
|
22
|
+
)
|
23
|
+
(?:(?:\s+AS)?\s+(?:\w+|"\w+"))?
|
24
|
+
)
|
25
|
+
(?:\s*,\s*\g<1>)*
|
26
|
+
\z
|
27
|
+
/ix
|
28
|
+
end
|
29
|
+
|
30
|
+
def column_name_with_order_matcher
|
31
|
+
/
|
32
|
+
\A
|
33
|
+
(
|
34
|
+
(?:
|
35
|
+
# "table_name"."column_name" | function(one or no argument)
|
36
|
+
((?:\w+\.|"\w+"\.)?(?:\w+|"\w+") | \w+\((?:|\g<2>)\))
|
37
|
+
)
|
38
|
+
(?:\s+ASC|\s+DESC)?
|
39
|
+
(?:\s+NULLS\s+(?:FIRST|LAST))?
|
40
|
+
)
|
41
|
+
(?:\s*,\s*\g<1>)*
|
42
|
+
\z
|
43
|
+
/ix
|
44
|
+
end
|
45
|
+
|
46
|
+
def quote_column_name(name) # :nodoc:
|
47
|
+
name = name.to_s
|
48
|
+
QUOTED_COLUMN_NAMES[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name)
|
49
|
+
"\"#{name.upcase}\""
|
50
|
+
else
|
51
|
+
# remove double quotes which cannot be used inside quoted identifier
|
52
|
+
"\"#{name.delete('"')}\""
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def quote_table_name(name) # :nodoc:
|
57
|
+
name, _link = name.to_s.split("@")
|
58
|
+
QUOTED_TABLE_NAMES[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".")
|
20
59
|
end
|
21
60
|
end
|
22
61
|
|
@@ -67,11 +106,6 @@ module ActiveRecord
|
|
67
106
|
!!(object_name =~ /[A-Z]/ && object_name =~ /[a-z]/)
|
68
107
|
end
|
69
108
|
|
70
|
-
def quote_table_name(name) # :nodoc:
|
71
|
-
name, _link = name.to_s.split("@")
|
72
|
-
QUOTED_TABLE_NAMES[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".")
|
73
|
-
end
|
74
|
-
|
75
109
|
def quote_string(s) # :nodoc:
|
76
110
|
s.gsub(/'/, "''")
|
77
111
|
end
|
@@ -131,42 +165,6 @@ module ActiveRecord
|
|
131
165
|
end
|
132
166
|
end
|
133
167
|
|
134
|
-
def column_name_matcher
|
135
|
-
COLUMN_NAME
|
136
|
-
end
|
137
|
-
|
138
|
-
def column_name_with_order_matcher
|
139
|
-
COLUMN_NAME_WITH_ORDER
|
140
|
-
end
|
141
|
-
|
142
|
-
COLUMN_NAME = /
|
143
|
-
\A
|
144
|
-
(
|
145
|
-
(?:
|
146
|
-
# "table_name"."column_name" | function(one or no argument)
|
147
|
-
((?:\w+\.|"\w+"\.)?(?:\w+|"\w+") | \w+\((?:|\g<2>)\))
|
148
|
-
)
|
149
|
-
(?:(?:\s+AS)?\s+(?:\w+|"\w+"))?
|
150
|
-
)
|
151
|
-
(?:\s*,\s*\g<1>)*
|
152
|
-
\z
|
153
|
-
/ix
|
154
|
-
|
155
|
-
COLUMN_NAME_WITH_ORDER = /
|
156
|
-
\A
|
157
|
-
(
|
158
|
-
(?:
|
159
|
-
# "table_name"."column_name" | function(one or no argument)
|
160
|
-
((?:\w+\.|"\w+"\.)?(?:\w+|"\w+") | \w+\((?:|\g<2>)\))
|
161
|
-
)
|
162
|
-
(?:\s+ASC|\s+DESC)?
|
163
|
-
(?:\s+NULLS\s+(?:FIRST|LAST))?
|
164
|
-
)
|
165
|
-
(?:\s*,\s*\g<1>)*
|
166
|
-
\z
|
167
|
-
/ix
|
168
|
-
private_constant :COLUMN_NAME, :COLUMN_NAME_WITH_ORDER
|
169
|
-
|
170
168
|
private
|
171
169
|
def oracle_downcase(column_name)
|
172
170
|
return nil if column_name.nil?
|
@@ -252,7 +252,7 @@ module ActiveRecord
|
|
252
252
|
rebuild_primary_key_index_to_default_tablespace(table_name, options)
|
253
253
|
end
|
254
254
|
|
255
|
-
def rename_table(table_name, new_name) # :nodoc:
|
255
|
+
def rename_table(table_name, new_name, **options) # :nodoc:
|
256
256
|
if new_name.to_s.length > DatabaseLimits::IDENTIFIER_MAX_LENGTH
|
257
257
|
raise ArgumentError, "New table name '#{new_name}' is too long; the limit is #{DatabaseLimits::IDENTIFIER_MAX_LENGTH} characters"
|
258
258
|
end
|
@@ -261,7 +261,7 @@ module ActiveRecord
|
|
261
261
|
execute "RENAME #{quote_table_name(table_name)} TO #{quote_table_name(new_name)}"
|
262
262
|
execute "RENAME #{quote_table_name("#{table_name}_seq")} TO #{default_sequence_name(new_name)}" rescue nil
|
263
263
|
|
264
|
-
rename_table_indexes(table_name, new_name)
|
264
|
+
rename_table_indexes(table_name, new_name, **options)
|
265
265
|
end
|
266
266
|
|
267
267
|
def drop_table(table_name, **options) # :nodoc:
|
@@ -276,7 +276,7 @@ module ActiveRecord
|
|
276
276
|
end
|
277
277
|
|
278
278
|
def insert_versions_sql(versions) # :nodoc:
|
279
|
-
sm_table = quote_table_name(ActiveRecord::
|
279
|
+
sm_table = quote_table_name(ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool.schema_migration.table_name)
|
280
280
|
|
281
281
|
if supports_multi_insert?
|
282
282
|
versions.inject(+"INSERT ALL\n") { |sql, version|
|
@@ -622,6 +622,13 @@ module ActiveRecord
|
|
622
622
|
OracleEnhanced::AlterTable.new create_table_definition(name)
|
623
623
|
end
|
624
624
|
|
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
|
+
|
625
632
|
def update_table_definition(table_name, base)
|
626
633
|
OracleEnhanced::Table.new(table_name, base)
|
627
634
|
end
|
@@ -63,22 +63,6 @@ require "active_record/type/oracle_enhanced/timestampltz"
|
|
63
63
|
require "active_record/type/oracle_enhanced/character_string"
|
64
64
|
|
65
65
|
module ActiveRecord
|
66
|
-
module ConnectionHandling # :nodoc:
|
67
|
-
# Establishes a connection to the database that's used by all Active Record objects.
|
68
|
-
def oracle_enhanced_connection(config) # :nodoc:
|
69
|
-
if config[:emulate_oracle_adapter] == true
|
70
|
-
# allows the enhanced adapter to look like the OracleAdapter. Useful to pick up
|
71
|
-
# conditionals in the rails activerecord test suite
|
72
|
-
require "active_record/connection_adapters/emulation/oracle_adapter"
|
73
|
-
ConnectionAdapters::OracleAdapter.new(
|
74
|
-
ConnectionAdapters::OracleEnhanced::Connection.create(config), logger, config)
|
75
|
-
else
|
76
|
-
ConnectionAdapters::OracleEnhancedAdapter.new(
|
77
|
-
ConnectionAdapters::OracleEnhanced::Connection.create(config), logger, config)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
66
|
module ConnectionAdapters # :nodoc:
|
83
67
|
# Oracle enhanced adapter will work with both
|
84
68
|
# CRuby ruby-oci8 gem (which provides interface to Oracle OCI client)
|
@@ -467,7 +451,7 @@ module ActiveRecord
|
|
467
451
|
end
|
468
452
|
|
469
453
|
# Reconnects to the database.
|
470
|
-
def reconnect! # :nodoc:
|
454
|
+
def reconnect!(restore_transactions: false) # :nodoc:
|
471
455
|
super
|
472
456
|
_connection.reset!
|
473
457
|
rescue OracleEnhanced::ConnectionException => e
|
@@ -837,6 +821,26 @@ module ActiveRecord
|
|
837
821
|
end
|
838
822
|
end
|
839
823
|
|
824
|
+
## Register OracleEnhancedAdapter as the adapter to use for "oracle_enhanced" connection string
|
825
|
+
if ActiveRecord::ConnectionAdapters.respond_to?(:register)
|
826
|
+
ActiveRecord::ConnectionAdapters.register(
|
827
|
+
"oracle_enhanced",
|
828
|
+
"ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter",
|
829
|
+
"active_record/connection_adapters/oracle_enhanced_adapter"
|
830
|
+
)
|
831
|
+
|
832
|
+
# This is similar to the notion of emulating the original OracleAdapter but
|
833
|
+
# using the OracleEnhancedAdapter instead, but without using the emulate flag.
|
834
|
+
# Instead this will get picked up if you set the adapter to 'oracle' in the database config.
|
835
|
+
#
|
836
|
+
# Register OracleAdapter as the adapter to use for "oracle" connection string
|
837
|
+
ActiveRecord::ConnectionAdapters.register(
|
838
|
+
"oracle",
|
839
|
+
"ActiveRecord::ConnectionAdapters::OracleAdapter",
|
840
|
+
"active_record/connection_adapters/emulation/oracle_adapter"
|
841
|
+
)
|
842
|
+
end
|
843
|
+
|
840
844
|
require "active_record/connection_adapters/oracle_enhanced/version"
|
841
845
|
|
842
846
|
module ActiveRecord
|
data/lib/arel/visitors/oracle.rb
CHANGED
@@ -195,14 +195,6 @@ module Arel # :nodoc: all
|
|
195
195
|
array
|
196
196
|
end
|
197
197
|
|
198
|
-
def visit_ActiveModel_Attribute(o, collector)
|
199
|
-
collector.add_bind(o) { |i| ":a#{i}" }
|
200
|
-
end
|
201
|
-
|
202
|
-
def visit_Arel_Nodes_BindParam(o, collector)
|
203
|
-
collector.add_bind(o.value) { |i| ":a#{i}" }
|
204
|
-
end
|
205
|
-
|
206
198
|
def is_distinct_from(o, collector)
|
207
199
|
collector << "DECODE("
|
208
200
|
collector = visit [o.left, o.right, 0, 1], collector
|
@@ -100,14 +100,6 @@ module Arel # :nodoc: all
|
|
100
100
|
super
|
101
101
|
end
|
102
102
|
|
103
|
-
def visit_ActiveModel_Attribute(o, collector)
|
104
|
-
collector.add_bind(o) { |i| ":a#{i}" }
|
105
|
-
end
|
106
|
-
|
107
|
-
def visit_Arel_Nodes_BindParam(o, collector)
|
108
|
-
collector.add_bind(o.value) { |i| ":a#{i}" }
|
109
|
-
end
|
110
|
-
|
111
103
|
def is_distinct_from(o, collector)
|
112
104
|
collector << "DECODE("
|
113
105
|
collector = visit [o.left, o.right, 0, 1], collector
|
@@ -3,6 +3,11 @@
|
|
3
3
|
module Arel # :nodoc: all
|
4
4
|
module Visitors
|
5
5
|
module OracleCommon
|
6
|
+
BIND_BLOCK = proc { |i| ":a#{i}" }
|
7
|
+
private_constant :BIND_BLOCK
|
8
|
+
|
9
|
+
def bind_block; BIND_BLOCK; end
|
10
|
+
|
6
11
|
private
|
7
12
|
# Oracle can't compare CLOB columns with standard SQL operators for comparison.
|
8
13
|
# We need to replace standard equality for text/binary columns to use DBMS_LOB.COMPARE function.
|
@@ -10,7 +10,7 @@ describe "OracleEnhancedAdapter emulate OracleAdapter" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should be an OracleAdapter" do
|
13
|
-
@conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(
|
13
|
+
@conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(adapter: "oracle"))
|
14
14
|
expect(ActiveRecord::Base.connection).not_to be_nil
|
15
15
|
expect(ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter)).to be_truthy
|
16
16
|
end
|
@@ -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
|
@@ -30,6 +30,12 @@ describe "OracleEnhancedAdapter establish connection" do
|
|
30
30
|
expect(ActiveRecord::Base.connection).to be_active
|
31
31
|
end
|
32
32
|
|
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
|
+
|
33
39
|
it "should use database default cursor_sharing parameter value force by default" do
|
34
40
|
# Use `SYSTEM_CONNECTION_PARAMS` to query v$parameter
|
35
41
|
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS)
|
@@ -81,7 +81,7 @@ describe "Oracle Enhanced adapter database tasks" do
|
|
81
81
|
describe "structure" do
|
82
82
|
let(:temp_file) { Tempfile.create(["oracle_enhanced", ".sql"]).path }
|
83
83
|
before do
|
84
|
-
ActiveRecord::Base.
|
84
|
+
ActiveRecord::Base.connection_pool.schema_migration.create_table
|
85
85
|
ActiveRecord::Base.connection.execute "INSERT INTO schema_migrations (version) VALUES ('20150101010000')"
|
86
86
|
end
|
87
87
|
|
@@ -109,7 +109,7 @@ describe "Oracle Enhanced adapter database tasks" do
|
|
109
109
|
|
110
110
|
after do
|
111
111
|
File.unlink(temp_file)
|
112
|
-
ActiveRecord::Base.
|
112
|
+
ActiveRecord::Base.connection_pool.schema_migration.drop_table
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -14,7 +14,7 @@ describe "OracleEnhancedAdapter schema dump" do
|
|
14
14
|
def standard_dump(options = {})
|
15
15
|
stream = StringIO.new
|
16
16
|
ActiveRecord::SchemaDumper.ignore_tables = options[:ignore_tables] || []
|
17
|
-
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.
|
17
|
+
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection_pool, stream)
|
18
18
|
stream.string
|
19
19
|
end
|
20
20
|
|
@@ -387,6 +387,34 @@ describe "OracleEnhancedAdapter schema definition" do
|
|
387
387
|
end
|
388
388
|
end
|
389
389
|
|
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
|
+
|
390
418
|
describe "ignore options for LOB columns" do
|
391
419
|
after(:each) do
|
392
420
|
schema_define do
|
@@ -1227,8 +1255,7 @@ end
|
|
1227
1255
|
|
1228
1256
|
before do
|
1229
1257
|
@conn = ActiveRecord::Base.connection
|
1230
|
-
|
1231
|
-
ActiveRecord::Base.connection.schema_migration.create_table
|
1258
|
+
ActiveRecord::Base.connection_pool.schema_migration.create_table
|
1232
1259
|
end
|
1233
1260
|
|
1234
1261
|
context "multi insert is supported" do
|
@@ -1256,7 +1283,7 @@ end
|
|
1256
1283
|
end
|
1257
1284
|
|
1258
1285
|
after do
|
1259
|
-
ActiveRecord::Base.
|
1286
|
+
ActiveRecord::Base.connection_pool.schema_migration.drop_table
|
1260
1287
|
end
|
1261
1288
|
end
|
1262
1289
|
end
|
@@ -334,9 +334,9 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
334
334
|
let(:dump) { ActiveRecord::Base.connection.dump_schema_information }
|
335
335
|
|
336
336
|
before do
|
337
|
-
ActiveRecord::Base.
|
337
|
+
ActiveRecord::Base.connection_pool.schema_migration.create_table
|
338
338
|
versions.each do |i|
|
339
|
-
ActiveRecord::Base.
|
339
|
+
ActiveRecord::Base.connection_pool.schema_migration.create_version(i)
|
340
340
|
end
|
341
341
|
end
|
342
342
|
|
@@ -376,7 +376,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
376
376
|
end
|
377
377
|
|
378
378
|
after do
|
379
|
-
ActiveRecord::Base.
|
379
|
+
ActiveRecord::Base.connection_pool.schema_migration.drop_table
|
380
380
|
end
|
381
381
|
end
|
382
382
|
|
@@ -354,15 +354,15 @@ describe "OracleEnhancedAdapter" do
|
|
354
354
|
|
355
355
|
it "should explain query" do
|
356
356
|
explain = TestPost.where(id: 1).explain
|
357
|
-
expect(explain).to include("Cost")
|
358
|
-
expect(explain).to include("INDEX UNIQUE SCAN")
|
357
|
+
expect(explain.inspect).to include("Cost")
|
358
|
+
expect(explain.inspect).to include("INDEX UNIQUE SCAN")
|
359
359
|
end
|
360
360
|
|
361
361
|
it "should explain query with binds" do
|
362
362
|
binds = [ActiveRecord::Relation::QueryAttribute.new("id", 1, ActiveRecord::Type::OracleEnhanced::Integer.new)]
|
363
363
|
explain = TestPost.where(id: binds).explain
|
364
|
-
expect(explain).to include("Cost")
|
365
|
-
expect(explain).to include("INDEX UNIQUE SCAN").or include("TABLE ACCESS FULL")
|
364
|
+
expect(explain.inspect).to include("Cost")
|
365
|
+
expect(explain.inspect).to include("INDEX UNIQUE SCAN").or include("TABLE ACCESS FULL")
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
@@ -768,13 +768,13 @@ describe "OracleEnhancedAdapter" do
|
|
768
768
|
it "should explain considers hints" do
|
769
769
|
post = TestPost.optimizer_hints("FULL (\"TEST_POSTS\")")
|
770
770
|
post = post.where(id: 1)
|
771
|
-
expect(post.explain).to include("| TABLE ACCESS FULL| TEST_POSTS |")
|
771
|
+
expect(post.explain.inspect).to include("| TABLE ACCESS FULL| TEST_POSTS |")
|
772
772
|
end
|
773
773
|
|
774
774
|
it "should explain considers hints with /*+ */" do
|
775
775
|
post = TestPost.optimizer_hints("/*+ FULL (\"TEST_POSTS\") */")
|
776
776
|
post = post.where(id: 1)
|
777
|
-
expect(post.explain).to include("| TABLE ACCESS FULL| TEST_POSTS |")
|
777
|
+
expect(post.explain.inspect).to include("| TABLE ACCESS FULL| TEST_POSTS |")
|
778
778
|
end
|
779
779
|
end
|
780
780
|
|
data/spec/spec_helper.rb
CHANGED
@@ -33,9 +33,9 @@ require "active_support/log_subscriber"
|
|
33
33
|
require "active_record/log_subscriber"
|
34
34
|
|
35
35
|
require "logger"
|
36
|
+
require "ruby-plsql"
|
36
37
|
|
37
38
|
require "active_record/connection_adapters/oracle_enhanced_adapter"
|
38
|
-
require "ruby-plsql"
|
39
39
|
|
40
40
|
puts "==> Effective ActiveRecord version #{ActiveRecord::VERSION::STRING}"
|
41
41
|
|
@@ -133,7 +133,7 @@ module SchemaDumpingHelper
|
|
133
133
|
old_ignore_tables = ActiveRecord::SchemaDumper.ignore_tables
|
134
134
|
ActiveRecord::SchemaDumper.ignore_tables = connection.data_sources - [table]
|
135
135
|
stream = StringIO.new
|
136
|
-
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.
|
136
|
+
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection_pool, stream)
|
137
137
|
stream.string
|
138
138
|
ensure
|
139
139
|
ActiveRecord::SchemaDumper.ignore_tables = old_ignore_tables
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-oracle_enhanced-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activerecord
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.
|
18
|
+
version: 7.2.0
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.
|
25
|
+
version: 7.2.0
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: ruby-plsql
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +103,7 @@ files:
|
|
104
103
|
- lib/arel/visitors/oracle12.rb
|
105
104
|
- lib/arel/visitors/oracle_common.rb
|
106
105
|
- spec/active_record/connection_adapters/emulation/oracle_adapter_spec.rb
|
106
|
+
- spec/active_record/connection_adapters/oracle_enhanced/compatibility_spec.rb
|
107
107
|
- spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb
|
108
108
|
- spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb
|
109
109
|
- spec/active_record/connection_adapters/oracle_enhanced/database_tasks_spec.rb
|
@@ -139,7 +139,6 @@ licenses:
|
|
139
139
|
- MIT
|
140
140
|
metadata:
|
141
141
|
rubygems_mfa_required: 'true'
|
142
|
-
post_install_message:
|
143
142
|
rdoc_options: []
|
144
143
|
require_paths:
|
145
144
|
- lib
|
@@ -147,19 +146,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
146
|
requirements:
|
148
147
|
- - ">="
|
149
148
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
149
|
+
version: 3.1.0
|
151
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
151
|
requirements:
|
153
152
|
- - ">="
|
154
153
|
- !ruby/object:Gem::Version
|
155
154
|
version: 1.8.11
|
156
155
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
158
|
-
signing_key:
|
156
|
+
rubygems_version: 3.6.7
|
159
157
|
specification_version: 4
|
160
158
|
summary: Oracle enhanced adapter for ActiveRecord
|
161
159
|
test_files:
|
162
160
|
- spec/active_record/connection_adapters/emulation/oracle_adapter_spec.rb
|
161
|
+
- spec/active_record/connection_adapters/oracle_enhanced/compatibility_spec.rb
|
163
162
|
- spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb
|
164
163
|
- spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb
|
165
164
|
- spec/active_record/connection_adapters/oracle_enhanced/database_tasks_spec.rb
|