activerecord-oracle_enhanced-adapter 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -28
- data/History.md +14 -0
- data/README.md +23 -0
- data/VERSION +1 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +2 -2
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +0 -14
- data/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb +7 -3
- data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb +2 -3
- data/lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb +2 -2
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +5 -25
- data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +11 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +7 -35
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +1 -6
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +1 -5
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +14 -30
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +10 -5
- metadata +64 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d99c4b97f53eecf7ac93bda8a0227e2a70e26a46
|
4
|
+
data.tar.gz: e56c8c915a99a5aa4ac33dd677a88115a5b6c3a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f67caad4031fb546f11244bbe6fe31d95c3a1d50459279b6d53edbba944eea48e53eb63b879755682a93166d4a10e7aa5171fa32f3901b7f787d2ec722f48275
|
7
|
+
data.tar.gz: 94067d976fee397e877c152f4d789525747b3dc344e8e5c321308046abb6a0c1df0d79d810254399b63e0cf5a7da81d733828f50c508bd4bd7d5ed1b9bb13698
|
data/Gemfile
CHANGED
@@ -5,38 +5,19 @@ group :development do
|
|
5
5
|
gem 'rspec', '~> 2.4'
|
6
6
|
gem 'rdoc'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
else
|
14
|
-
%w(activerecord activemodel activesupport actionpack railties).each do |gem_name|
|
15
|
-
if ENV['RAILS_GEM_PATH']
|
16
|
-
gem gem_name, :path => File.join(ENV['RAILS_GEM_PATH'], gem_name)
|
17
|
-
else
|
18
|
-
gem gem_name, :git => "git://github.com/rails/rails"
|
19
|
-
end
|
20
|
-
end
|
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'
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
else
|
25
|
-
gem 'arel', :git => "git://github.com/rails/arel"
|
26
|
-
end
|
14
|
+
gem 'arel', github: 'rails/arel'
|
15
|
+
gem 'journey', github: 'rails/journey'
|
27
16
|
|
28
|
-
|
29
|
-
gem 'journey', :path => ENV['JOURNEY_GEM_PATH']
|
30
|
-
else
|
31
|
-
gem "journey", :git => "git://github.com/rails/journey"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
gem "activerecord-deprecated_finders"
|
17
|
+
gem 'activerecord-deprecated_finders'
|
36
18
|
gem 'ruby-plsql', '>=0.5.0'
|
37
19
|
|
38
20
|
platforms :ruby do
|
39
|
-
gem 'ruby-oci8', '
|
21
|
+
gem 'ruby-oci8', github: 'kubo/ruby-oci8'
|
40
22
|
end
|
41
|
-
|
42
23
|
end
|
data/History.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 1.5.1 / 2013-11-30
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Removed set_table_name set_primary_key set_sequence_name from unit tests [#364]
|
5
|
+
* Update README to support assignment methods [#365]
|
6
|
+
* Remove add_limit_offset! method [#369]
|
7
|
+
* Update Gemfile to use `bundle config --local` [#370]
|
8
|
+
* `describe` does not try super when no datbase link and ORA-4043 returned [#375]
|
9
|
+
* Support `remove_columns` [#377]
|
10
|
+
* Dump views in alphabetical order and add `FORCE` option [#378]
|
11
|
+
|
12
|
+
* Bug Fix
|
13
|
+
* Fixed reverting add_column fails with v1.5.0 [#373]
|
14
|
+
|
1
15
|
## 1.5.0 / 2013-11-01
|
2
16
|
|
3
17
|
* Enhancements
|
data/README.md
CHANGED
@@ -177,6 +177,29 @@ See other adapter settings in [oracle_enhanced_adapter.rb](http://github.com/rsi
|
|
177
177
|
|
178
178
|
If you want to put Oracle enhanced adapter on top of existing schema tables then there are several methods how to override ActiveRecord defaults, see example:
|
179
179
|
|
180
|
+
class Employee < ActiveRecord::Base
|
181
|
+
# specify schema and table name
|
182
|
+
self.table_name "hr.hr_employees"
|
183
|
+
# specify primary key name
|
184
|
+
self.primary_key "employee_id"
|
185
|
+
# specify sequence name
|
186
|
+
self.sequence_name "hr.hr_employee_s"
|
187
|
+
# set which DATE columns should be converted to Ruby Date
|
188
|
+
set_date_columns :hired_on, :birth_date_on
|
189
|
+
# set which DATE columns should be converted to Ruby Time
|
190
|
+
set_datetime_columns :last_login_time
|
191
|
+
# set which VARCHAR2 columns should be converted to true and false
|
192
|
+
set_boolean_columns :manager, :active
|
193
|
+
# set which columns should be ignored in ActiveRecord
|
194
|
+
ignore_table_columns :attribute1, :attribute2
|
195
|
+
end
|
196
|
+
|
197
|
+
You can also access remote tables over database link using
|
198
|
+
|
199
|
+
self.table_name "hr_employees@db_link"
|
200
|
+
|
201
|
+
Examples for Rails 3.2 and lower version of Rails
|
202
|
+
|
180
203
|
class Employee < ActiveRecord::Base
|
181
204
|
# specify schema and table name
|
182
205
|
set_table_name "hr.hr_employees"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.1
|
@@ -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.1"
|
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{2013-11-
|
13
|
+
s.date = %q{2013-11-30}
|
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
|
}
|
@@ -950,20 +950,6 @@ module ActiveRecord
|
|
950
950
|
# there is no RELEASE SAVEPOINT statement in Oracle
|
951
951
|
end
|
952
952
|
|
953
|
-
def add_limit_offset!(sql, options) #:nodoc:
|
954
|
-
# added to_i for limit and offset to protect from SQL injection
|
955
|
-
offset = (options[:offset] || 0).to_i
|
956
|
-
limit = options[:limit]
|
957
|
-
limit = limit.is_a?(String) && limit.blank? ? nil : limit && limit.to_i
|
958
|
-
if limit && offset > 0
|
959
|
-
sql.replace "SELECT * FROM (SELECT raw_sql_.*, ROWNUM raw_rnum_ FROM (#{sql}) raw_sql_ WHERE ROWNUM <= #{offset+limit}) WHERE raw_rnum_ > #{offset}"
|
960
|
-
elsif limit
|
961
|
-
sql.replace "SELECT * FROM (#{sql}) WHERE ROWNUM <= #{limit}"
|
962
|
-
elsif offset > 0
|
963
|
-
sql.replace "SELECT * FROM (SELECT raw_sql_.*, ROWNUM raw_rnum_ FROM (#{sql}) raw_sql_) WHERE raw_rnum_ > #{offset}"
|
964
|
-
end
|
965
|
-
end
|
966
|
-
|
967
953
|
@@do_not_prefetch_primary_key = {}
|
968
954
|
|
969
955
|
# Returns true for Oracle adapter (since Oracle requires primary key
|
@@ -208,15 +208,19 @@ module ActiveRecord
|
|
208
208
|
def write_lob(lob, value, is_binary = false)
|
209
209
|
lob.write value
|
210
210
|
end
|
211
|
-
|
211
|
+
|
212
212
|
def describe(name)
|
213
213
|
# fall back to SELECT based describe if using database link
|
214
214
|
return super if name.to_s.include?('@')
|
215
215
|
quoted_name = OracleEnhancedAdapter.valid_table_name?(name) ? name : "\"#{name}\""
|
216
216
|
@raw_connection.describe(quoted_name)
|
217
217
|
rescue OCIException => e
|
218
|
-
|
219
|
-
|
218
|
+
if e.code == 4043
|
219
|
+
raise OracleEnhancedConnectionException, %Q{"DESC #{name}" failed; does it exist?}
|
220
|
+
else
|
221
|
+
# fall back to SELECT which can handle synonyms to database links
|
222
|
+
super
|
223
|
+
end
|
220
224
|
end
|
221
225
|
|
222
226
|
# Return OCIError error code
|
@@ -329,9 +329,8 @@ module ActiveRecord
|
|
329
329
|
clear_table_columns_cache(table_name)
|
330
330
|
end
|
331
331
|
|
332
|
-
def remove_column(table_name,
|
333
|
-
|
334
|
-
column_names.each {|column_name| execute "ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"}
|
332
|
+
def remove_column(table_name, column_name, type = nil, options = {}) #:nodoc:
|
333
|
+
execute "ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"
|
335
334
|
ensure
|
336
335
|
clear_table_columns_cache(table_name)
|
337
336
|
self.all_schema_indexes = nil
|
@@ -164,8 +164,8 @@ module ActiveRecord #:nodoc:
|
|
164
164
|
end
|
165
165
|
|
166
166
|
# export views
|
167
|
-
select_all("SELECT view_name, text FROM user_views").each do |view|
|
168
|
-
structure << "CREATE OR REPLACE VIEW #{view['view_name']} AS\n #{view['text']}"
|
167
|
+
select_all("SELECT view_name, text FROM user_views ORDER BY view_name ASC").each do |view|
|
168
|
+
structure << "CREATE OR REPLACE FORCE VIEW #{view['view_name']} AS\n #{view['text']}"
|
169
169
|
end
|
170
170
|
|
171
171
|
# export synonyms
|
@@ -140,11 +140,7 @@ describe "OracleEnhancedAdapter" do
|
|
140
140
|
end
|
141
141
|
# Another class using the same table
|
142
142
|
class ::TestEmployee2 < ActiveRecord::Base
|
143
|
-
|
144
|
-
self.table_name = "test_employees"
|
145
|
-
else
|
146
|
-
set_table_name "test_employees"
|
147
|
-
end
|
143
|
+
self.table_name = "test_employees"
|
148
144
|
end
|
149
145
|
end
|
150
146
|
|
@@ -267,11 +263,7 @@ describe "OracleEnhancedAdapter" do
|
|
267
263
|
SQL
|
268
264
|
Object.send(:remove_const, 'CompositePrimaryKeys') if defined?(CompositePrimaryKeys)
|
269
265
|
class ::TestEmployee < ActiveRecord::Base
|
270
|
-
|
271
|
-
self.primary_key = :employee_id
|
272
|
-
else
|
273
|
-
set_primary_key :employee_id
|
274
|
-
end
|
266
|
+
self.primary_key = :employee_id
|
275
267
|
end
|
276
268
|
end
|
277
269
|
|
@@ -448,11 +440,7 @@ describe "OracleEnhancedAdapter" do
|
|
448
440
|
it "should allow creation of a table with non alphanumeric characters" do
|
449
441
|
create_warehouse_things_table
|
450
442
|
class ::WarehouseThing < ActiveRecord::Base
|
451
|
-
|
452
|
-
self.table_name = "warehouse-things"
|
453
|
-
else
|
454
|
-
set_table_name "warehouse-things"
|
455
|
-
end
|
443
|
+
self.table_name = "warehouse-things"
|
456
444
|
end
|
457
445
|
|
458
446
|
wh = WarehouseThing.create!(:name => "Foo", :foo => 2)
|
@@ -464,11 +452,7 @@ describe "OracleEnhancedAdapter" do
|
|
464
452
|
it "should allow creation of a table with CamelCase name" do
|
465
453
|
create_camel_case_table
|
466
454
|
class ::CamelCase < ActiveRecord::Base
|
467
|
-
|
468
|
-
self.table_name = "CamelCase"
|
469
|
-
else
|
470
|
-
set_table_name "CamelCase"
|
471
|
-
end
|
455
|
+
self.table_name = "CamelCase"
|
472
456
|
end
|
473
457
|
|
474
458
|
cc = CamelCase.create!(:name => "Foo", :foo => 2)
|
@@ -500,11 +484,7 @@ describe "OracleEnhancedAdapter" do
|
|
500
484
|
@conn.execute "CREATE OR REPLACE SYNONYM test_posts_seq FOR test_posts_seq@#{@db_link}"
|
501
485
|
class ::TestPost < ActiveRecord::Base
|
502
486
|
end
|
503
|
-
|
504
|
-
TestPost.table_name = "test_posts"
|
505
|
-
else
|
506
|
-
TestPost.set_table_name "test_posts"
|
507
|
-
end
|
487
|
+
TestPost.table_name = "test_posts"
|
508
488
|
end
|
509
489
|
|
510
490
|
after(:all) do
|
@@ -330,6 +330,17 @@ describe "OracleEnhancedConnection" do
|
|
330
330
|
@conn.describe("all_tables").should == ["SYS", "ALL_TABLES"]
|
331
331
|
end
|
332
332
|
|
333
|
+
if defined?(OCI8)
|
334
|
+
context "OCI8 adapter" do
|
335
|
+
|
336
|
+
it "should not fallback to SELECT-based logic when querying non-existant table information" do
|
337
|
+
@conn.should_not_receive(:select_one)
|
338
|
+
@conn.describe("non_existant") rescue ActiveRecord::ConnectionAdapters::OracleEnhancedConnectionException
|
339
|
+
end
|
340
|
+
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
333
344
|
end
|
334
345
|
|
335
346
|
end
|
@@ -89,11 +89,7 @@ describe "OracleEnhancedAdapter date type detection based on column names" do
|
|
89
89
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
|
90
90
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates = false
|
91
91
|
class ::TestEmployee < ActiveRecord::Base
|
92
|
-
|
93
|
-
self.primary_key = "employee_id"
|
94
|
-
else
|
95
|
-
set_primary_key "employee_id"
|
96
|
-
end
|
92
|
+
self.primary_key = "employee_id"
|
97
93
|
end
|
98
94
|
end
|
99
95
|
|
@@ -569,11 +565,7 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
|
|
569
565
|
describe "/ TIMESTAMP WITH TIME ZONE values from ActiveRecord model" do
|
570
566
|
before(:all) do
|
571
567
|
class ::TestEmployee < ActiveRecord::Base
|
572
|
-
|
573
|
-
self.primary_key = "employee_id"
|
574
|
-
else
|
575
|
-
set_primary_key "employee_id"
|
576
|
-
end
|
568
|
+
self.primary_key = "employee_id"
|
577
569
|
end
|
578
570
|
end
|
579
571
|
|
@@ -655,11 +647,7 @@ describe "OracleEnhancedAdapter date and timestamp with different NLS date forma
|
|
655
647
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates = false
|
656
648
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
|
657
649
|
class ::TestEmployee < ActiveRecord::Base
|
658
|
-
|
659
|
-
self.primary_key = "employee_id"
|
660
|
-
else
|
661
|
-
set_primary_key "employee_id"
|
662
|
-
end
|
650
|
+
self.primary_key = "employee_id"
|
663
651
|
end
|
664
652
|
@today = Date.new(2008,6,28)
|
665
653
|
@now = Time.local(2008,6,28,13,34,33)
|
@@ -744,11 +732,7 @@ describe "OracleEnhancedAdapter assign string to :date and :datetime columns" do
|
|
744
732
|
INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE
|
745
733
|
SQL
|
746
734
|
class ::TestEmployee < ActiveRecord::Base
|
747
|
-
|
748
|
-
self.primary_key = "employee_id"
|
749
|
-
else
|
750
|
-
set_primary_key "employee_id"
|
751
|
-
end
|
735
|
+
self.primary_key = "employee_id"
|
752
736
|
end
|
753
737
|
@today = Date.new(2008,6,28)
|
754
738
|
@today_iso = "2008-06-28"
|
@@ -918,11 +902,7 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
|
|
918
902
|
serialize :comments
|
919
903
|
end
|
920
904
|
class ::TestEmployeeReadOnlyClob < ActiveRecord::Base
|
921
|
-
|
922
|
-
self.table_name = "test_employees"
|
923
|
-
else
|
924
|
-
set_table_name = "test_employees"
|
925
|
-
end
|
905
|
+
self.table_name = "test_employees"
|
926
906
|
attr_readonly :comments
|
927
907
|
end
|
928
908
|
end
|
@@ -1097,11 +1077,7 @@ describe "OracleEnhancedAdapter handling of BLOB columns" do
|
|
1097
1077
|
|
1098
1078
|
before(:each) do
|
1099
1079
|
class ::TestEmployee < ActiveRecord::Base
|
1100
|
-
|
1101
|
-
self.primary_key = "employee_id"
|
1102
|
-
else
|
1103
|
-
set_primary_key "employee_id"
|
1104
|
-
end
|
1080
|
+
self.primary_key = "employee_id"
|
1105
1081
|
end
|
1106
1082
|
end
|
1107
1083
|
|
@@ -1227,11 +1203,7 @@ describe "OracleEnhancedAdapter handling of RAW columns" do
|
|
1227
1203
|
|
1228
1204
|
before(:each) do
|
1229
1205
|
class ::TestEmployee < ActiveRecord::Base
|
1230
|
-
|
1231
|
-
self.primary_key = "employee_id"
|
1232
|
-
else
|
1233
|
-
set_primary_key "employee_id"
|
1234
|
-
end
|
1206
|
+
self.primary_key = "employee_id"
|
1235
1207
|
end
|
1236
1208
|
end
|
1237
1209
|
|
@@ -108,12 +108,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
|
|
108
108
|
before(:each) do
|
109
109
|
class ::TestEmployee < ActiveRecord::Base
|
110
110
|
include ActiveRecord::OracleEnhancedProcedures
|
111
|
-
|
112
|
-
if self.respond_to?(:primary_key=)
|
113
|
-
self.primary_key = :employee_id
|
114
|
-
else
|
115
|
-
set_primary_key :employee_id
|
116
|
-
end
|
111
|
+
self.primary_key = :employee_id
|
117
112
|
|
118
113
|
validates_presence_of :first_name, :last_name, :hire_date
|
119
114
|
|
@@ -369,11 +369,7 @@ describe "OracleEnhancedAdapter schema dump" do
|
|
369
369
|
before(:each) do
|
370
370
|
if @oracle11g_or_higher
|
371
371
|
class ::TestName < ActiveRecord::Base
|
372
|
-
|
373
|
-
self.table_name = "test_names"
|
374
|
-
else
|
375
|
-
set_table_name "test_names"
|
376
|
-
end
|
372
|
+
self.table_name = "test_names"
|
377
373
|
end
|
378
374
|
end
|
379
375
|
end
|
@@ -24,11 +24,7 @@ describe "OracleEnhancedAdapter schema definition" do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
class ::Keyboard < ActiveRecord::Base
|
27
|
-
|
28
|
-
self.primary_key = :key_number
|
29
|
-
else
|
30
|
-
set_primary_key :key_number
|
31
|
-
end
|
27
|
+
self.primary_key = :key_number
|
32
28
|
end
|
33
29
|
class ::IdKeyboard < ActiveRecord::Base
|
34
30
|
end
|
@@ -246,11 +242,7 @@ describe "OracleEnhancedAdapter schema definition" do
|
|
246
242
|
@sequence_name = "test_employees_s"
|
247
243
|
create_table_with_trigger(:primary_key => @primary_key, :sequence_name => @sequence_name)
|
248
244
|
class ::TestEmployee < ActiveRecord::Base
|
249
|
-
|
250
|
-
self.primary_key = "employee_id"
|
251
|
-
else
|
252
|
-
set_primary_key "employee_id"
|
253
|
-
end
|
245
|
+
self.primary_key = "employee_id"
|
254
246
|
end
|
255
247
|
end
|
256
248
|
|
@@ -282,11 +274,7 @@ describe "OracleEnhancedAdapter schema definition" do
|
|
282
274
|
@sequence_name = "test_employees_s"
|
283
275
|
create_table_with_trigger(:sequence_name => @sequence_name, :trigger_name => "test_employees_t1")
|
284
276
|
class ::TestEmployee < ActiveRecord::Base
|
285
|
-
|
286
|
-
self.sequence_name = :autogenerated
|
287
|
-
else
|
288
|
-
set_sequence_name :autogenerated
|
289
|
-
end
|
277
|
+
self.sequence_name = :autogenerated
|
290
278
|
end
|
291
279
|
end
|
292
280
|
|
@@ -941,11 +929,7 @@ end
|
|
941
929
|
|
942
930
|
before(:each) do
|
943
931
|
class ::TestPost < ActiveRecord::Base
|
944
|
-
|
945
|
-
self.table_name = "synonym_to_posts"
|
946
|
-
else
|
947
|
-
set_table_name "synonym_to_posts"
|
948
|
-
end
|
932
|
+
self.table_name = "synonym_to_posts"
|
949
933
|
end
|
950
934
|
end
|
951
935
|
|
@@ -1083,6 +1067,14 @@ end
|
|
1083
1067
|
TestPost.columns_hash['title'].should be_nil
|
1084
1068
|
TestPost.columns_hash['content'].should be_nil
|
1085
1069
|
end
|
1070
|
+
|
1071
|
+
it "should ignore type and options parameter and remove column" do
|
1072
|
+
schema_define do
|
1073
|
+
remove_column :test_posts, :title, :string, {}
|
1074
|
+
end
|
1075
|
+
TestPost.reset_column_information
|
1076
|
+
TestPost.columns_hash['title'].should be_nil
|
1077
|
+
end
|
1086
1078
|
end
|
1087
1079
|
|
1088
1080
|
describe 'virtual columns in create_table' do
|
@@ -1098,11 +1090,7 @@ end
|
|
1098
1090
|
end
|
1099
1091
|
end
|
1100
1092
|
class ::TestFraction < ActiveRecord::Base
|
1101
|
-
|
1102
|
-
self.table_name = "test_fractions"
|
1103
|
-
else
|
1104
|
-
set_table_name "test_fractions"
|
1105
|
-
end
|
1093
|
+
self.table_name = "test_fractions"
|
1106
1094
|
end
|
1107
1095
|
|
1108
1096
|
TestFraction.reset_column_information
|
@@ -1147,11 +1135,7 @@ end
|
|
1147
1135
|
end
|
1148
1136
|
end
|
1149
1137
|
class ::TestFraction < ActiveRecord::Base
|
1150
|
-
|
1151
|
-
self.table_name = "test_fractions"
|
1152
|
-
else
|
1153
|
-
set_table_name "test_fractions"
|
1154
|
-
end
|
1138
|
+
self.table_name = "test_fractions"
|
1155
1139
|
end
|
1156
1140
|
TestFraction.reset_column_information
|
1157
1141
|
end
|
@@ -20,11 +20,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
20
20
|
end
|
21
21
|
class ::TestPost < ActiveRecord::Base
|
22
22
|
end
|
23
|
-
|
24
|
-
TestPost.table_name = "test_posts"
|
25
|
-
else
|
26
|
-
TestPost.set_table_name "test_posts"
|
27
|
-
end
|
23
|
+
TestPost.table_name = "test_posts"
|
28
24
|
end
|
29
25
|
|
30
26
|
after(:each) do
|
@@ -41,6 +37,8 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
41
37
|
@conn.execute "ALTER TABLE foos drop column baz_id" rescue nil
|
42
38
|
@conn.execute "ALTER TABLE test_posts drop column fooz_id" rescue nil
|
43
39
|
@conn.execute "ALTER TABLE test_posts drop column baz_id" rescue nil
|
40
|
+
@conn.execute "DROP VIEW test_posts_view_z" rescue nil
|
41
|
+
@conn.execute "DROP VIEW test_posts_view_a" rescue nil
|
44
42
|
end
|
45
43
|
|
46
44
|
it "should dump single primary key" do
|
@@ -142,6 +140,13 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
142
140
|
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/,' ')
|
143
141
|
dump.should =~ /CREATE OR REPLACE TYPE TEST_TYPE/
|
144
142
|
end
|
143
|
+
|
144
|
+
it "should dump views" do
|
145
|
+
@conn.execute "create or replace VIEW test_posts_view_z as select * from test_posts"
|
146
|
+
@conn.execute "create or replace VIEW test_posts_view_a as select * from test_posts_view_z"
|
147
|
+
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/,' ')
|
148
|
+
dump.should =~ /CREATE OR REPLACE FORCE VIEW TEST_POSTS_VIEW_A.*CREATE OR REPLACE FORCE VIEW TEST_POSTS_VIEW_Z/
|
149
|
+
end
|
145
150
|
|
146
151
|
it "should dump virtual columns" do
|
147
152
|
pending "Not supported in this database version" unless @oracle11g_or_higher
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|
@@ -56,58 +56,100 @@ dependencies:
|
|
56
56
|
name: activerecord
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: activemodel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - '
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - '
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activesupport
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - '
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: actionpack
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - '
|
108
|
+
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: railties
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - '
|
115
|
+
- - '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - '
|
122
|
+
- - '>='
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: arel
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: journey
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
154
|
name: activerecord-deprecated_finders
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +184,14 @@ dependencies:
|
|
142
184
|
requirements:
|
143
185
|
- - '>='
|
144
186
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
187
|
+
version: '0'
|
146
188
|
type: :development
|
147
189
|
prerelease: false
|
148
190
|
version_requirements: !ruby/object:Gem::Requirement
|
149
191
|
requirements:
|
150
192
|
- - '>='
|
151
193
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
194
|
+
version: '0'
|
153
195
|
description: |
|
154
196
|
Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
|
155
197
|
This adapter is superset of original ActiveRecord Oracle adapter.
|
@@ -222,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
264
|
version: '0'
|
223
265
|
requirements: []
|
224
266
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.1.
|
267
|
+
rubygems_version: 2.1.11
|
226
268
|
signing_key:
|
227
269
|
specification_version: 4
|
228
270
|
summary: Oracle enhanced adapter for ActiveRecord
|