activerecord-oracle_enhanced-adapter 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +10 -0
- data/VERSION +1 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +2 -2
- data/lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb +19 -5
- data/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb +3 -2
- data/lib/active_record/connection_adapters/oracle_enhanced_schema_dumper.rb +3 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de6010dec5446b296a5ad3d372f6aaad1ac71549
|
4
|
+
data.tar.gz: c82a83f8d18e75b367925eb029f786b567e1f6e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8887e65c6d08ede8097bdeb8951227edd05c92c943074853fb6caf16009033af74407d24d03da3ca9184aa0b37633939fec5174f07aac38d85ef84abdbd620f6
|
7
|
+
data.tar.gz: 0f3843a406fbe8945785b85ee849debb10636e82161b7423da0643bb6c2c3ee8f92b2bf0e5e46b5ec577ebdeda0d9020c63b8fa1624f7a325b5d9c110f72372e
|
data/History.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 1.5.4 / 2014-03-25
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Support Rails 4.1.0.rc2
|
5
|
+
* Allow Java 8 to run with jruby [#383]
|
6
|
+
|
7
|
+
* Bug Fix
|
8
|
+
* Fix db:schema:dump when foreign key column name is not 'id' [#409]
|
9
|
+
* Fix schema dump works when non Oracle adapter used [#428]
|
10
|
+
|
1
11
|
## 1.5.3 / 2014-03-04
|
2
12
|
|
3
13
|
* Enhancements
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.4
|
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{activerecord-oracle_enhanced-adapter}
|
8
|
-
s.version = "1.5.
|
8
|
+
s.version = "1.5.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.license = 'MIT'
|
12
12
|
s.authors = [%q{Raimonds Simanovskis}]
|
13
|
-
s.date = %q{2014-03-
|
13
|
+
s.date = %q{2014-03-25}
|
14
14
|
s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
|
15
15
|
This adapter is superset of original ActiveRecord Oracle adapter.
|
16
16
|
}
|
@@ -8,16 +8,23 @@ module ActiveRecord #:nodoc:
|
|
8
8
|
alias_method_chain :column_spec, :oracle_enhanced
|
9
9
|
alias_method_chain :prepare_column_options, :oracle_enhanced
|
10
10
|
alias_method_chain :migration_keys, :oracle_enhanced
|
11
|
+
|
12
|
+
def oracle_enhanced_adapter?
|
13
|
+
# return original method if not using 'OracleEnhanced'
|
14
|
+
if (rails_env = defined?(Rails.env) ? Rails.env : (defined?(RAILS_ENV) ? RAILS_ENV : nil)) &&
|
15
|
+
ActiveRecord::Base.configurations[rails_env] &&
|
16
|
+
ActiveRecord::Base.configurations[rails_env]['adapter'] != 'oracle_enhanced'
|
17
|
+
return false
|
18
|
+
else
|
19
|
+
return true
|
20
|
+
end
|
21
|
+
end
|
11
22
|
end
|
12
23
|
end
|
13
24
|
|
14
25
|
def column_spec_with_oracle_enhanced(column, types)
|
15
26
|
# return original method if not using 'OracleEnhanced'
|
16
|
-
|
17
|
-
ActiveRecord::Base.configurations[rails_env] &&
|
18
|
-
ActiveRecord::Base.configurations[rails_env]['adapter'] != 'oracle_enhanced'
|
19
|
-
return column_spec_with_oracle_enhanced(column, types)
|
20
|
-
end
|
27
|
+
return column_spec_without_oracle_enhanced(column, types) unless oracle_enhanced_adapter?
|
21
28
|
|
22
29
|
spec = prepare_column_options(column, types)
|
23
30
|
(spec.keys - [:name, :type]).each do |k|
|
@@ -28,6 +35,9 @@ module ActiveRecord #:nodoc:
|
|
28
35
|
end
|
29
36
|
|
30
37
|
def prepare_column_options_with_oracle_enhanced(column, types)
|
38
|
+
# return original method if not using 'OracleEnhanced'
|
39
|
+
return prepare_column_options_without_oracle_enhanced(column, types) unless oracle_enhanced_adapter?
|
40
|
+
|
31
41
|
spec = {}
|
32
42
|
spec[:name] = column.name.inspect
|
33
43
|
spec[:type] = column.virtual? ? 'virtual' : column.type.to_s
|
@@ -43,9 +53,13 @@ module ActiveRecord #:nodoc:
|
|
43
53
|
|
44
54
|
def migration_keys_with_oracle_enhanced
|
45
55
|
# TODO `& column_specs.map(&:keys).flatten` should be exetuted here
|
56
|
+
# return original method if not using 'OracleEnhanced'
|
57
|
+
return migration_keys_without_oracle_enhanced unless oracle_enhanced_adapter?
|
58
|
+
|
46
59
|
[:name, :limit, :precision, :scale, :default, :null, :as, :virtual_type]
|
47
60
|
end
|
48
61
|
|
62
|
+
|
49
63
|
end
|
50
64
|
end
|
51
65
|
end
|
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
%w(ojdbc5.jar)
|
10
10
|
elsif java_version =~ /^1.6/
|
11
11
|
%w(ojdbc6.jar)
|
12
|
-
elsif java_version
|
12
|
+
elsif java_version >= '1.7'
|
13
13
|
# Oracle 11g client ojdbc6.jar is also compatible with Java 1.7
|
14
14
|
# Oracle 12c client provides new ojdbc7.jar
|
15
15
|
%w(ojdbc7.jar ojdbc6.jar)
|
@@ -26,6 +26,7 @@ begin
|
|
26
26
|
# check any compatible JDBC driver in the priority order
|
27
27
|
ojdbc_jars.any? do |ojdbc_jar|
|
28
28
|
if File.exists?(file_path = File.join(dir, ojdbc_jar))
|
29
|
+
puts "WARNING: JDK #{java_version} is not officially supported by #{ojdbc_jar}" if java_version >= '1.8'
|
29
30
|
require file_path
|
30
31
|
true
|
31
32
|
end
|
@@ -43,7 +44,7 @@ begin
|
|
43
44
|
|
44
45
|
rescue LoadError, NameError
|
45
46
|
# JDBC driver is unavailable.
|
46
|
-
raise LoadError, "ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install #{ojdbc_jars.join(' or ')
|
47
|
+
raise LoadError, "ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install #{ojdbc_jars ? ojdbc_jars.join(' or ') : "Oracle JDBC"} library."
|
47
48
|
end
|
48
49
|
|
49
50
|
|
@@ -61,15 +61,15 @@ module ActiveRecord #:nodoc:
|
|
61
61
|
add_foreign_key_statements = foreign_keys.map do |foreign_key|
|
62
62
|
statement_parts = [ ('add_foreign_key ' + foreign_key.from_table.inspect) ]
|
63
63
|
statement_parts << foreign_key.to_table.inspect
|
64
|
-
|
64
|
+
|
65
65
|
if foreign_key.options[:columns].size == 1
|
66
66
|
column = foreign_key.options[:columns].first
|
67
67
|
if column != "#{foreign_key.to_table.singularize}_id"
|
68
68
|
statement_parts << ('column: ' + column.inspect)
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
if foreign_key.options[:references].first != 'id'
|
72
|
-
statement_parts << ('primary_key: ' + foreign_key.options[:
|
72
|
+
statement_parts << ('primary_key: ' + foreign_key.options[:references].first.inspect)
|
73
73
|
end
|
74
74
|
else
|
75
75
|
statement_parts << ('columns: ' + foreign_key.options[:columns].inspect)
|
@@ -251,6 +251,26 @@ describe "OracleEnhancedAdapter schema dump" do
|
|
251
251
|
dump = standard_dump
|
252
252
|
dump.rindex("create_table").should < dump.index("add_foreign_key")
|
253
253
|
end
|
254
|
+
|
255
|
+
it "should include primary_key when reference column name is not 'id'" do
|
256
|
+
schema_define do
|
257
|
+
create_table :test_posts, force: true, :primary_key => 'baz_id' do |t|
|
258
|
+
t.string :title
|
259
|
+
end
|
260
|
+
create_table :test_comments, force: true do |t|
|
261
|
+
t.string :body, limit: 4000
|
262
|
+
t.integer :baz_id
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
@conn.execute <<-SQL
|
267
|
+
ALTER TABLE TEST_COMMENTS
|
268
|
+
ADD CONSTRAINT TEST_COMMENTS_BAZ_ID_FK FOREIGN KEY (baz_id) REFERENCES test_posts(baz_id)
|
269
|
+
SQL
|
270
|
+
|
271
|
+
standard_dump.should =~ /add_foreign_key "test_comments", "test_posts", column: "baz_id", primary_key: "baz_id", name: "test_comments_baz_id_fk"/
|
272
|
+
end
|
273
|
+
|
254
274
|
end
|
255
275
|
|
256
276
|
describe "synonyms" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-oracle_enhanced-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|