activerecord-oracle_enhanced-adapter 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -5
- data/History.md +16 -0
- data/README.md +9 -1
- data/VERSION +1 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +2 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +2 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +10 -5
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +0 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +28 -1
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +1 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +40 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +1 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +15 -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: 3140aab4b8a424d37dbf40c830b1078da12c520a
|
4
|
+
data.tar.gz: 5a4dda72b35ed5f9578ec10b21b2bf647ce3dd48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b966b3ee7215ae2b724667d0eb929fdd2c2e5d7d8b98f7bfdcd66490e3a7fa7907dfbc1c3ec23fe42c358b7509a7035f67ad9b1d0815738f8d6cde248d72e34
|
7
|
+
data.tar.gz: 69feaef9c100e36ef781663aaaf98dafa72ee8f30d34b83611015da18311381bacec12c7ff97e846829076e4c9f9c411aeca1994478f3cb09bfd8fabb049889a
|
data/Gemfile
CHANGED
@@ -5,11 +5,11 @@ group :development do
|
|
5
5
|
gem 'rspec', '~> 2.4'
|
6
6
|
gem 'rdoc'
|
7
7
|
|
8
|
-
gem 'activerecord', github: 'rails/rails'
|
9
|
-
gem 'activemodel', github: 'rails/rails'
|
10
|
-
gem 'activesupport', github: 'rails/rails'
|
11
|
-
gem 'actionpack', github: 'rails/rails'
|
12
|
-
gem 'railties', github: 'rails/rails'
|
8
|
+
gem 'activerecord', github: 'rails/rails', branch: '4-2-stable'
|
9
|
+
gem 'activemodel', github: 'rails/rails', branch: '4-2-stable'
|
10
|
+
gem 'activesupport', github: 'rails/rails', branch: '4-2-stable'
|
11
|
+
gem 'actionpack', github: 'rails/rails', branch: '4-2-stable'
|
12
|
+
gem 'railties', github: 'rails/rails', branch: '4-2-stable'
|
13
13
|
|
14
14
|
gem 'arel', github: 'rails/arel', branch: '6-0-stable'
|
15
15
|
gem 'journey', github: 'rails/journey'
|
data/History.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 1.6.4 / 2015-11-09
|
2
|
+
|
3
|
+
* Changes and bug fixes since 1.6.2
|
4
|
+
* Add table and column comments to structure dump and schema dump [#734]
|
5
|
+
* Remove `serialized_attributes` which is removed in Rails 5 [#694]
|
6
|
+
* fixing bundler dependency conflict with head of rails vs arel 6.0[#714]
|
7
|
+
* Add note to readme about adapter name when using DATABASE_URL [#728]
|
8
|
+
* Fixed copy/paste error in README.md [#731]
|
9
|
+
* Pending a test using virtual columns features introduced in 11gR1 [#733]
|
10
|
+
* Suppress warning: ambiguous first argument [#690]
|
11
|
+
* Suppress `warning: assigned but unused variable` [#691]
|
12
|
+
* Suppress `warning: assigned but unused variable - tablespace` [#692]
|
13
|
+
* Suppress `warning: assigned but unused variable - e` [#693]
|
14
|
+
* Ignore .rbenv-gemsets [#705]
|
15
|
+
* Clean up database objects after unit tests executed [#712]
|
16
|
+
|
1
17
|
## 1.6.3 / 2015-08-14
|
2
18
|
|
3
19
|
* Changes and bug fixes since 1.6.2
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ When using Ruby on Rails version 4.2 then in Gemfile include
|
|
19
19
|
gem 'activerecord-oracle_enhanced-adapter', '~> 1.6.0'
|
20
20
|
```
|
21
21
|
|
22
|
-
where instead of 1.6.0 you can specify any other desired version. It is recommended to specify version with `~>` which means that use specified version or later patch versions (in this example any later 1.
|
22
|
+
where instead of 1.6.0 you can specify any other desired version. It is recommended to specify version with `~>` which means that use specified version or later patch versions (in this example any later 1.6.x version but not 1.7.x version). Oracle enhanced adapter maintains API backwards compatibility during patch version upgrades and therefore it is safe to always upgrade to latest patch version.
|
23
23
|
|
24
24
|
### Rails 4.0 and 4.1
|
25
25
|
|
@@ -178,6 +178,14 @@ development:
|
|
178
178
|
password: secret
|
179
179
|
```
|
180
180
|
|
181
|
+
|
182
|
+
If you choose to specify your database connection via the `DATABASE_URL`
|
183
|
+
environment variable, note that the adapter name uses a dash instead of an underscore:
|
184
|
+
|
185
|
+
```bash
|
186
|
+
DATABASE_URL=oracle-enhanced://localhost/XE
|
187
|
+
```
|
188
|
+
|
181
189
|
If you deploy JRuby on Rails application in Java application server that supports JNDI connections then you can specify JNDI connection as well:
|
182
190
|
|
183
191
|
```yml
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.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.6.
|
8
|
+
s.version = "1.6.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{2015-
|
13
|
+
s.date = %q{2015-11-09}
|
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
|
}
|
@@ -48,6 +48,7 @@ module ActiveRecord #:nodoc:
|
|
48
48
|
spec[:null] = 'false' if !column.null
|
49
49
|
spec[:as] = column.virtual_column_data_default if column.virtual?
|
50
50
|
spec[:default] = schema_default(column) if column.has_default? && !column.virtual?
|
51
|
+
spec[:comment] = column.comment.inspect unless column.comment.nil?
|
51
52
|
spec.delete(:default) if spec[:default].nil?
|
52
53
|
spec
|
53
54
|
end
|
@@ -57,7 +58,7 @@ module ActiveRecord #:nodoc:
|
|
57
58
|
# return original method if not using 'OracleEnhanced'
|
58
59
|
return migration_keys_without_oracle_enhanced unless oracle_enhanced_adapter?
|
59
60
|
|
60
|
-
[:name, :limit, :precision, :scale, :default, :null, :as, :virtual_type]
|
61
|
+
[:name, :limit, :precision, :scale, :default, :null, :as, :virtual_type, :comment]
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
@@ -229,7 +229,7 @@ module ActiveRecord
|
|
229
229
|
# Returns default sequence name for table.
|
230
230
|
# Will take all or first 26 characters of table name and append _seq suffix
|
231
231
|
def default_sequence_name(table_name, primary_key = nil)
|
232
|
-
table_name.to_s.gsub /(^|\.)([\w$-]{1,#{sequence_name_length-4}})([\w$-]*)
|
232
|
+
table_name.to_s.gsub (/(^|\.)([\w$-]{1,#{sequence_name_length-4}})([\w$-]*)$/), '\1\2_seq'
|
233
233
|
end
|
234
234
|
|
235
235
|
# Inserts the given fixture into the table. Overridden to properly handle lobs.
|
@@ -152,7 +152,7 @@ module ActiveRecord #:nodoc:
|
|
152
152
|
if partial_writes?
|
153
153
|
# Serialized attributes should always be written in case they've been
|
154
154
|
# changed in place.
|
155
|
-
update_using_custom_method(changed | (attributes.keys & self.class.
|
155
|
+
update_using_custom_method(changed | (attributes.keys & self.class.columns.select {|column| column.cast_type.is_a?(Type::Serialized)}))
|
156
156
|
else
|
157
157
|
update_using_custom_method(attribute_names)
|
158
158
|
end
|
@@ -50,7 +50,7 @@ module ActiveRecord #:nodoc:
|
|
50
50
|
|
51
51
|
def primary_key_trigger(table_name, stream)
|
52
52
|
if @connection.respond_to?(:has_primary_key_trigger?) && @connection.has_primary_key_trigger?(table_name)
|
53
|
-
pk,
|
53
|
+
pk, _pk_seq = @connection.pk_and_sequence_for(table_name)
|
54
54
|
stream.print " add_primary_key_trigger #{table_name.inspect}"
|
55
55
|
stream.print ", primary_key: \"#{pk}\"" if pk != 'id'
|
56
56
|
stream.print "\n\n"
|
@@ -121,16 +121,21 @@ module ActiveRecord #:nodoc:
|
|
121
121
|
|
122
122
|
# first dump primary key column
|
123
123
|
if @connection.respond_to?(:pk_and_sequence_for)
|
124
|
-
pk,
|
124
|
+
pk, _pk_seq = @connection.pk_and_sequence_for(table)
|
125
125
|
elsif @connection.respond_to?(:primary_key)
|
126
126
|
pk = @connection.primary_key(table)
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
tbl.print " create_table #{table.inspect}"
|
130
|
-
|
130
|
+
|
131
131
|
# addition to make temporary option work
|
132
132
|
tbl.print ", temporary: true" if @connection.temporary_table?(table)
|
133
|
-
|
133
|
+
|
134
|
+
table_comments = @connection.table_comment(table)
|
135
|
+
unless table_comments.nil?
|
136
|
+
tbl.print ", comment: #{table_comments.inspect}"
|
137
|
+
end
|
138
|
+
|
134
139
|
if columns.detect { |c| c.name == pk }
|
135
140
|
if pk != 'id'
|
136
141
|
tbl.print %Q(, primary_key: "#{pk}")
|
@@ -74,7 +74,6 @@ module ActiveRecord
|
|
74
74
|
yield td if block_given?
|
75
75
|
create_sequence = create_sequence || td.create_sequence
|
76
76
|
column_comments = td.column_comments if td.column_comments
|
77
|
-
tablespace = tablespace_for(:table, options[:tablespace])
|
78
77
|
|
79
78
|
if options[:force] && table_exists?(table_name)
|
80
79
|
drop_table(table_name, options)
|
@@ -34,6 +34,8 @@ module ActiveRecord #:nodoc:
|
|
34
34
|
structure << ddl
|
35
35
|
structure << structure_dump_indexes(table_name)
|
36
36
|
structure << structure_dump_unique_keys(table_name)
|
37
|
+
structure << structure_dump_table_comments(table_name)
|
38
|
+
structure << structure_dump_column_comments(table_name)
|
37
39
|
end
|
38
40
|
|
39
41
|
join_with_statement_token(structure) << structure_dump_fk_constraints
|
@@ -134,6 +136,31 @@ module ActiveRecord #:nodoc:
|
|
134
136
|
join_with_statement_token(fks)
|
135
137
|
end
|
136
138
|
|
139
|
+
def structure_dump_table_comments(table_name)
|
140
|
+
comments = []
|
141
|
+
comment = table_comment(table_name)
|
142
|
+
|
143
|
+
unless comment.nil?
|
144
|
+
comments << "COMMENT ON TABLE #{quote_table_name(table_name)} IS '#{quote_string(comment)}'"
|
145
|
+
end
|
146
|
+
|
147
|
+
join_with_statement_token(comments)
|
148
|
+
end
|
149
|
+
|
150
|
+
def structure_dump_column_comments(table_name)
|
151
|
+
comments = []
|
152
|
+
columns = select_values("SELECT column_name FROM user_tab_columns WHERE table_name = '#{table_name}' ORDER BY column_id")
|
153
|
+
|
154
|
+
columns.each do |column|
|
155
|
+
comment = column_comment(table_name, column)
|
156
|
+
unless comment.nil?
|
157
|
+
comments << "COMMENT ON COLUMN #{quote_table_name(table_name)}.#{quote_column_name(column)} IS '#{quote_string(comment)}'"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
join_with_statement_token(comments)
|
162
|
+
end
|
163
|
+
|
137
164
|
def foreign_key_definition(to_table, options = {}) #:nodoc:
|
138
165
|
columns = Array(options[:column] || options[:columns])
|
139
166
|
|
@@ -280,7 +307,7 @@ module ActiveRecord #:nodoc:
|
|
280
307
|
AND table_name = '#{table.upcase}'
|
281
308
|
SQL
|
282
309
|
# feature not supported previous to 11g
|
283
|
-
rescue ActiveRecord::StatementInvalid =>
|
310
|
+
rescue ActiveRecord::StatementInvalid => _e
|
284
311
|
[]
|
285
312
|
end
|
286
313
|
end
|
@@ -862,7 +862,7 @@ module ActiveRecord
|
|
862
862
|
|
863
863
|
# Will return true if database object exists (to be able to use also views and synonyms for ActiveRecord models)
|
864
864
|
def table_exists?(table_name)
|
865
|
-
(
|
865
|
+
(_owner, table_name, _db_link) = @connection.describe(table_name)
|
866
866
|
true
|
867
867
|
rescue
|
868
868
|
false
|
@@ -474,4 +474,44 @@ describe "OracleEnhancedAdapter schema dump" do
|
|
474
474
|
standard_dump.should =~ /t\.float "hourly_rate"$/
|
475
475
|
end
|
476
476
|
end
|
477
|
+
|
478
|
+
describe "table comments" do
|
479
|
+
before(:each) do
|
480
|
+
schema_define do
|
481
|
+
create_table :test_table_comments, :comment => "this is a \"table comment\"!", force: true do |t|
|
482
|
+
t.string :blah
|
483
|
+
end
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
after(:each) do
|
488
|
+
schema_define do
|
489
|
+
drop_table :test_table_comments
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
it "should dump table comments" do
|
494
|
+
standard_dump.should =~ /comment: "this is a \\"table comment\\"!"/
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
describe "column comments" do
|
499
|
+
before(:each) do
|
500
|
+
schema_define do
|
501
|
+
create_table :test_column_comments, force: true do |t|
|
502
|
+
t.string :blah, :comment => "this is a \"column comment\"!"
|
503
|
+
end
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
after(:each) do
|
508
|
+
schema_define do
|
509
|
+
drop_table :test_column_comments
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
it "should dump column comments" do
|
514
|
+
standard_dump.should =~ /comment: "this is a \\"column comment\\"!"/
|
515
|
+
end
|
516
|
+
end
|
477
517
|
end
|
@@ -423,6 +423,7 @@ describe "OracleEnhancedAdapter schema definition" do
|
|
423
423
|
drop_table :new_test_employees rescue nil
|
424
424
|
drop_table :test_employees_no_pkey rescue nil
|
425
425
|
drop_table :new_test_employees_no_pkey rescue nil
|
426
|
+
drop_table :aaaaaaaaaaaaaaaaaaaaaaaaaaa rescue nil
|
426
427
|
end
|
427
428
|
end
|
428
429
|
|
@@ -163,6 +163,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should dump RAW virtual columns" do
|
166
|
+
pending "Not supported in this database version" unless @oracle11g_or_higher
|
166
167
|
@conn.execute <<-SQL
|
167
168
|
CREATE TABLE bars (
|
168
169
|
id NUMBER(38,0) NOT NULL,
|
@@ -225,6 +226,20 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
225
226
|
dump.should =~ /CREATE TABLE \"BARS\" \(\n\"ID\" NUMBER\(38,0\) NOT NULL,\n \"SUPER\" RAW\(255\)/
|
226
227
|
end
|
227
228
|
|
229
|
+
it "should dump table comments" do
|
230
|
+
comment_sql = %Q(COMMENT ON TABLE "TEST_POSTS" IS 'Test posts with ''some'' "quotes"')
|
231
|
+
@conn.execute comment_sql
|
232
|
+
dump = ActiveRecord::Base.connection.structure_dump
|
233
|
+
dump.should =~ /#{comment_sql}/
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should dump column comments" do
|
237
|
+
comment_sql = %Q(COMMENT ON COLUMN "TEST_POSTS"."TITLE" IS 'The title of the post with ''some'' "quotes"')
|
238
|
+
@conn.execute comment_sql
|
239
|
+
dump = ActiveRecord::Base.connection.structure_dump
|
240
|
+
dump.should =~ /#{comment_sql}/
|
241
|
+
end
|
242
|
+
|
228
243
|
end
|
229
244
|
describe "temporary tables" do
|
230
245
|
after(:all) 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.6.
|
4
|
+
version: 1.6.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: 2015-
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|