activerecord-oracle_enhanced-adapter 1.5.6 → 1.6.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/History.md +87 -0
  4. data/README.md +271 -174
  5. data/VERSION +1 -1
  6. data/activerecord-oracle_enhanced-adapter.gemspec +26 -22
  7. data/lib/active_record/connection_adapters/{oracle_enhanced_column.rb → oracle_enhanced/column.rb} +14 -63
  8. data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +65 -0
  9. data/lib/active_record/connection_adapters/{oracle_enhanced_connection.rb → oracle_enhanced/connection.rb} +2 -2
  10. data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +347 -0
  11. data/lib/active_record/connection_adapters/{oracle_enhanced_cpk.rb → oracle_enhanced/cpk.rb} +0 -0
  12. data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +257 -0
  13. data/lib/active_record/connection_adapters/{oracle_enhanced_database_tasks.rb → oracle_enhanced/database_tasks.rb} +0 -0
  14. data/lib/active_record/connection_adapters/oracle_enhanced/dirty.rb +40 -0
  15. data/lib/active_record/connection_adapters/{oracle_enhanced_jdbc_connection.rb → oracle_enhanced/jdbc_connection.rb} +0 -0
  16. data/lib/active_record/connection_adapters/{oracle_enhanced_oci_connection.rb → oracle_enhanced/oci_connection.rb} +0 -0
  17. data/lib/active_record/connection_adapters/{oracle_enhanced_procedures.rb → oracle_enhanced/procedures.rb} +0 -0
  18. data/lib/active_record/connection_adapters/{oracle_enhanced_schema_creation.rb → oracle_enhanced/schema_creation.rb} +17 -16
  19. data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +92 -0
  20. data/lib/active_record/connection_adapters/{oracle_enhanced_schema_dumper.rb → oracle_enhanced/schema_dumper.rb} +4 -32
  21. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +543 -0
  22. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +65 -0
  23. data/lib/active_record/connection_adapters/{oracle_enhanced_structure_dump.rb → oracle_enhanced/structure_dump.rb} +26 -4
  24. data/lib/active_record/connection_adapters/oracle_enhanced/version.rb +1 -0
  25. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +159 -66
  26. data/lib/active_record/oracle_enhanced/type/integer.rb +13 -0
  27. data/lib/active_record/oracle_enhanced/type/raw.rb +13 -0
  28. data/lib/active_record/oracle_enhanced/type/timestamp.rb +11 -0
  29. data/lib/activerecord-oracle_enhanced-adapter.rb +1 -1
  30. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +6 -31
  31. data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +1 -1
  32. data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +2 -2
  33. data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +2 -2
  34. data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +63 -63
  35. data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +1 -1
  36. data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +7 -13
  37. data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +21 -175
  38. data/spec/spec_config.yaml.template +10 -0
  39. data/spec/spec_helper.rb +21 -10
  40. metadata +29 -25
  41. data/lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb +0 -77
  42. data/lib/active_record/connection_adapters/oracle_enhanced_context_index.rb +0 -350
  43. data/lib/active_record/connection_adapters/oracle_enhanced_database_statements.rb +0 -262
  44. data/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb +0 -45
  45. data/lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb +0 -197
  46. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb +0 -450
  47. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements_ext.rb +0 -258
  48. data/lib/active_record/connection_adapters/oracle_enhanced_version.rb +0 -1
@@ -22,7 +22,7 @@ describe "OracleEnhancedAdapter schema dump" do
22
22
  schema_define do
23
23
  create_table :test_posts, options do |t|
24
24
  t.string :title
25
- t.timestamps
25
+ t.timestamps null: true
26
26
  end
27
27
  add_index :test_posts, :title
28
28
  end
@@ -376,7 +376,7 @@ describe "OracleEnhancedAdapter schema dump" do
376
376
  t.virtual :full_name, :as => "first_name || ', ' || last_name"
377
377
  t.virtual :short_name, :as => "COALESCE(first_name, last_name)", :type => :string, :limit => 300
378
378
  t.virtual :abbrev_name, :as => "SUBSTR(first_name,1,50) || ' ' || SUBSTR(last_name,1,1) || '.'", :type => "VARCHAR(100)"
379
- t.virtual :name_ratio, :as=>'(LENGTH(first_name)/LENGTH(last_name))'
379
+ t.virtual :name_ratio, :as=>'(LENGTH(first_name)*10/LENGTH(last_name)*10)'
380
380
  t.column :full_name_length, :virtual, :as => "length(first_name || ', ' || last_name)", :type => :integer
381
381
  t.virtual :field_with_leading_space, :as => "' ' || first_name || ' '", :limit => 300, :type => :string
382
382
  end
@@ -402,30 +402,13 @@ describe "OracleEnhancedAdapter schema dump" do
402
402
  end
403
403
  end
404
404
 
405
- context "when number_datatype_coercion is :float" do
406
- before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:float) }
407
-
408
- it 'should dump correctly' do
409
- standard_dump.should =~ /t\.virtual "full_name",(\s*)limit: 512,(\s*)as: "\\"FIRST_NAME\\"\|\|', '\|\|\\"LAST_NAME\\"",(\s*)type: :string/
410
- standard_dump.should =~ /t\.virtual "short_name",(\s*)limit: 300,(\s*)as:(.*),(\s*)type: :string/
411
- standard_dump.should =~ /t\.virtual "full_name_length",(\s*)precision: 38,(\s*)scale: 0,(\s*)as:(.*),(\s*)type: :integer/
412
- standard_dump.should =~ /t\.virtual "name_ratio",(\s*)as:(.*),(\s*)type: :float$/
413
- standard_dump.should =~ /t\.virtual "abbrev_name",(\s*)limit: 100,(\s*)as:(.*),(\s*)type: :string/
414
- standard_dump.should =~ /t\.virtual "field_with_leading_space",(\s*)limit: 300,(\s*)as: "' '\|\|\\"FIRST_NAME\\"\|\|' '",(\s*)type: :string/
415
- end
416
- end
417
-
418
- context "when number_datatype_coercion is :decimal" do
419
- before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:decimal) }
420
-
421
- it 'should dump correctly' do
422
- standard_dump.should =~ /t\.virtual "full_name",(\s*)limit: 512,(\s*)as: "\\"FIRST_NAME\\"\|\|', '\|\|\\"LAST_NAME\\"",(\s*)type: :string/
423
- standard_dump.should =~ /t\.virtual "short_name",(\s*)limit: 300,(\s*)as:(.*),(\s*)type: :string/
424
- standard_dump.should =~ /t\.virtual "full_name_length",(\s*)precision: 38,(\s*)scale: 0,(\s*)as:(.*),(\s*)type: :integer/
425
- standard_dump.should =~ /t\.virtual "name_ratio",(\s*)as:(.*)\"$/
426
- standard_dump.should =~ /t\.virtual "abbrev_name",(\s*)limit: 100,(\s*)as:(.*),(\s*)type: :string/
427
- standard_dump.should =~ /t\.virtual "field_with_leading_space",(\s*)limit: 300,(\s*)as: "' '\|\|\\"FIRST_NAME\\"\|\|' '",(\s*)type: :string/
428
- end
405
+ it 'should dump correctly' do
406
+ standard_dump.should =~ /t\.virtual "full_name",(\s*)limit: 512,(\s*)as: "\\"FIRST_NAME\\"\|\|', '\|\|\\"LAST_NAME\\"",(\s*)type: :string/
407
+ standard_dump.should =~ /t\.virtual "short_name",(\s*)limit: 300,(\s*)as:(.*),(\s*)type: :string/
408
+ standard_dump.should =~ /t\.virtual "full_name_length",(\s*)precision: 38,(\s*)scale: 0,(\s*)as:(.*),(\s*)type: :integer/
409
+ standard_dump.should =~ /t\.virtual "name_ratio",(\s*)as:(.*)\"$/ # no :type
410
+ standard_dump.should =~ /t\.virtual "abbrev_name",(\s*)limit: 100,(\s*)as:(.*),(\s*)type: :string/
411
+ standard_dump.should =~ /t\.virtual "field_with_leading_space",(\s*)limit: 300,(\s*)as: "' '\|\|\\"FIRST_NAME\\"\|\|' '",(\s*)type: :string/
429
412
  end
430
413
 
431
414
  context 'with column cache' do
@@ -471,160 +454,23 @@ describe "OracleEnhancedAdapter schema dump" do
471
454
  end
472
455
  end
473
456
 
474
- describe "NUMBER columns" do
475
- after(:each) do
457
+ describe ":float datatype" do
458
+ before(:each) do
476
459
  schema_define do
477
- drop_table "test_numbers"
478
- end
479
- end
480
-
481
- let(:value_within_max_precision) { (10 ** @conn.class::NUMBER_MAX_PRECISION) - 1 }
482
- let(:value_exceeding_max_precision) { (10 ** @conn.class::NUMBER_MAX_PRECISION) + 1 }
483
-
484
- context "when using ActiveRecord::Schema.define and ActiveRecord::ConnectionAdapters::TableDefinition#float" do
485
- before :each do
486
- schema_define do
487
- create_table :test_numbers, :force => true do |t|
488
- t.float :value
489
- end
490
- end
491
- end
492
-
493
- context "when number_datatype_coercion is :float" do
494
- before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:float) }
495
-
496
- it "should dump correctly" do
497
- standard_dump.should =~ /t\.float "value"$/
498
- end
499
- end
500
-
501
- context "when number_datatype_coercion is :decimal" do
502
- before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:decimal) }
503
-
504
- it "should dump correctly" do
505
- standard_dump.should =~ /t\.decimal "value"$/
460
+ create_table :test_floats, force: true do |t|
461
+ t.float :hourly_rate
506
462
  end
507
463
  end
508
464
  end
509
465
 
510
- context "when using handwritten 'CREATE_TABLE' SQL" do
511
- before :each do
512
- ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
513
- @conn = ActiveRecord::Base.connection
514
- @conn.execute <<-SQL
515
- CREATE TABLE test_numbers (
516
- id NUMBER(#{@conn.class::NUMBER_MAX_PRECISION},0) PRIMARY KEY,
517
- value NUMBER
518
- )
519
- SQL
520
- @conn.execute <<-SQL
521
- CREATE SEQUENCE test_numbers_seq MINVALUE 1
522
- INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE
523
- SQL
524
- end
525
-
526
- context "when number_datatype_coercion is :float" do
527
- before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:float) }
528
-
529
- it "should dump correctly" do
530
- standard_dump.should =~ /t\.float "value"$/
531
- end
532
-
533
- describe "ActiveRecord saving" do
534
- before :each do
535
- class ::TestNumber < ActiveRecord::Base
536
- self.table_name = "test_numbers"
537
- end
538
- end
539
-
540
- it "should allow saving of values within NUMBER_MAX_PRECISION" do
541
- number = TestNumber.new(value: value_within_max_precision)
542
- number.save!
543
- number.reload
544
- number.value.should eq(value_within_max_precision)
545
- end
546
-
547
- it "should allow saving of values larger than NUMBER_MAX_PRECISION" do
548
- number = TestNumber.new(value: value_exceeding_max_precision)
549
- number.save!
550
- number.reload
551
- number.value.should eq(value_exceeding_max_precision)
552
- end
553
-
554
- it "should be recreatable from dump and have same properties" do
555
- # Simulating db:schema:dump & db:test:load
556
- 2.times do
557
- create_table_dump = standard_dump[/(create_table.+?end)/m]
558
-
559
- schema_define do
560
- drop_table "test_numbers"
561
- end
562
-
563
- schema_define(&eval("-> * { #{create_table_dump} }"))
564
- end
565
-
566
- number = TestNumber.new(value: value_within_max_precision)
567
- number.save!
568
-
569
- number2 = TestNumber.new(value: value_exceeding_max_precision)
570
- number2.save!
571
- end
572
- end
466
+ after(:each) do
467
+ schema_define do
468
+ drop_table :test_floats
573
469
  end
470
+ end
574
471
 
575
- context "when number_datatype_coercion is :decimal" do
576
- before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:decimal) }
577
-
578
- it "should dump correctly" do
579
- standard_dump.should =~ /t\.decimal "value"$/
580
- end
581
-
582
- describe "ActiveRecord saving" do
583
- before :each do
584
- class ::TestNumber < ActiveRecord::Base
585
- self.table_name = "test_numbers"
586
- end
587
- end
588
-
589
- it "should allow saving of values within NUMBER_MAX_PRECISION" do
590
- number = TestNumber.new(value: value_within_max_precision)
591
- number.save!
592
- number.reload
593
- number.value.should eq(value_within_max_precision)
594
- end
595
-
596
- it "should allow saving of values larger than NUMBER_MAX_PRECISION" do
597
- number = TestNumber.new(value: value_exceeding_max_precision)
598
- number.save!
599
- number.reload
600
- number.value.should eq(value_exceeding_max_precision)
601
- end
602
-
603
- it "should be recreatable from dump and have same properties" do
604
- # Simulating db:schema:dump & db:test:load
605
- 2.times do |i|
606
- create_table_dump = standard_dump[/(create_table.+?end)/m]
607
-
608
- schema_define do
609
- drop_table "test_numbers"
610
- end
611
-
612
- schema_define(&eval("-> * { #{create_table_dump} }"))
613
- end
614
-
615
- number = TestNumber.new(value: value_within_max_precision)
616
- number.save!
617
-
618
- # Raises 'ORA-01438' as :value column type isn't FLOAT'ish
619
- number2 = TestNumber.new(value: value_exceeding_max_precision)
620
- lambda do
621
- number2.save!
622
- end.should raise_error() { |e| e.message.should =~ /ORA-01438/ }
623
- end
624
- end
625
- end # context (:decimal)
626
-
627
- end # context (handwritten)
628
- end # describe (NUMBER columns)
629
-
472
+ it "should dump float type correctly" do
473
+ standard_dump.should =~ /t\.float "hourly_rate"$/
474
+ end
475
+ end
630
476
  end
@@ -0,0 +1,10 @@
1
+ rails:
2
+ gem_version: '4.0-master'
3
+ database:
4
+ name: 'orcl'
5
+ host: '127.0.0.1'
6
+ port: 1521
7
+ user: 'oracle_enhanced'
8
+ password: 'oracle_enhanced'
9
+ sys_password: 'admin'
10
+ timezone: 'Europe/Riga'
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,17 @@
1
- require 'rubygems'
1
+ require "rubygems"
2
2
  require "bundler"
3
+ require "yaml"
3
4
  Bundler.setup(:default, :development)
4
5
 
5
6
  $:.unshift(File.expand_path('../../lib', __FILE__))
7
+ config_path = File.expand_path('../spec_config.yaml', __FILE__)
8
+ if File.exist?(config_path)
9
+ puts "==> Loading config from #{config_path}"
10
+ config = YAML.load_file(config_path)
11
+ else
12
+ puts "==> Loading config from ENV or use default"
13
+ config = {"rails" => {}, "database" => {}}
14
+ end
6
15
 
7
16
  require 'rspec'
8
17
 
@@ -13,10 +22,10 @@ elsif RUBY_ENGINE == 'jruby'
13
22
  puts "==> Running specs with JRuby version #{JRUBY_VERSION}"
14
23
  end
15
24
 
16
- ENV['RAILS_GEM_VERSION'] ||= '4.0-master'
25
+ ENV['RAILS_GEM_VERSION'] ||= config["rails"]["gem_version"] || '4.0-master'
17
26
  NO_COMPOSITE_PRIMARY_KEYS = true
18
27
 
19
- puts "==> Running specs with Rails version #{ENV['RAILS_GEM_VERSION']}"
28
+ puts "==> Selected Rails version #{ENV['RAILS_GEM_VERSION']}"
20
29
 
21
30
  require 'active_record'
22
31
 
@@ -32,6 +41,8 @@ require 'logger'
32
41
  require 'active_record/connection_adapters/oracle_enhanced_adapter'
33
42
  require 'ruby-plsql'
34
43
 
44
+ puts "==> Effective ActiveRecord version #{ActiveRecord::VERSION::STRING}"
45
+
35
46
  module LoggerSpecHelper
36
47
  def set_logger
37
48
  @logger = MockLogger.new
@@ -109,12 +120,12 @@ module SchemaSpecHelper
109
120
  end
110
121
  end
111
122
 
112
- DATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'
113
- DATABASE_HOST = ENV['DATABASE_HOST']
114
- DATABASE_PORT = ENV['DATABASE_PORT']
115
- DATABASE_USER = ENV['DATABASE_USER'] || 'oracle_enhanced'
116
- DATABASE_PASSWORD = ENV['DATABASE_PASSWORD'] || 'oracle_enhanced'
117
- DATABASE_SYS_PASSWORD = ENV['DATABASE_SYS_PASSWORD'] || 'admin'
123
+ DATABASE_NAME = config["database"]["name"] || ENV['DATABASE_NAME'] || 'orcl'
124
+ DATABASE_HOST = config["database"]["host"] || ENV['DATABASE_HOST'] || "127.0.0.1"
125
+ DATABASE_PORT = config["database"]["port"] || ENV['DATABASE_PORT'] || 1521
126
+ DATABASE_USER = config["database"]["user"] || ENV['DATABASE_USER'] || 'oracle_enhanced'
127
+ DATABASE_PASSWORD = config["database"]["password"] || ENV['DATABASE_PASSWORD'] || 'oracle_enhanced'
128
+ DATABASE_SYS_PASSWORD = config["database"]["sys_password"] || ENV['DATABASE_SYS_PASSWORD'] || 'admin'
118
129
 
119
130
  CONNECTION_PARAMS = {
120
131
  :adapter => "oracle_enhanced",
@@ -148,7 +159,7 @@ DATABASE_NON_DEFAULT_TABLESPACE = ENV['DATABASE_NON_DEFAULT_TABLESPACE'] || "SYS
148
159
 
149
160
  # set default time zone in TZ environment variable
150
161
  # which will be used to set session time zone
151
- ENV['TZ'] ||= 'Europe/Riga'
162
+ ENV['TZ'] ||= config["timezone"] || 'Europe/Riga'
152
163
 
153
164
  # ActiveRecord::Base.logger = Logger.new(STDOUT)
154
165
 
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.6
4
+ version: 1.6.0.beta1
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-03-31 00:00:00.000000000 Z
11
+ date: 2015-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeweler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -211,25 +211,28 @@ files:
211
211
  - VERSION
212
212
  - activerecord-oracle_enhanced-adapter.gemspec
213
213
  - lib/active_record/connection_adapters/emulation/oracle_adapter.rb
214
+ - lib/active_record/connection_adapters/oracle_enhanced/column.rb
215
+ - lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb
216
+ - lib/active_record/connection_adapters/oracle_enhanced/connection.rb
217
+ - lib/active_record/connection_adapters/oracle_enhanced/context_index.rb
218
+ - lib/active_record/connection_adapters/oracle_enhanced/cpk.rb
219
+ - lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb
220
+ - lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb
221
+ - lib/active_record/connection_adapters/oracle_enhanced/dirty.rb
222
+ - lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb
223
+ - lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb
224
+ - lib/active_record/connection_adapters/oracle_enhanced/procedures.rb
225
+ - lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb
226
+ - lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb
227
+ - lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb
228
+ - lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb
229
+ - lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb
230
+ - lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb
231
+ - lib/active_record/connection_adapters/oracle_enhanced/version.rb
214
232
  - lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
215
- - lib/active_record/connection_adapters/oracle_enhanced_column.rb
216
- - lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb
217
- - lib/active_record/connection_adapters/oracle_enhanced_connection.rb
218
- - lib/active_record/connection_adapters/oracle_enhanced_context_index.rb
219
- - lib/active_record/connection_adapters/oracle_enhanced_cpk.rb
220
- - lib/active_record/connection_adapters/oracle_enhanced_database_statements.rb
221
- - lib/active_record/connection_adapters/oracle_enhanced_database_tasks.rb
222
- - lib/active_record/connection_adapters/oracle_enhanced_dirty.rb
223
- - lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb
224
- - lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb
225
- - lib/active_record/connection_adapters/oracle_enhanced_procedures.rb
226
- - lib/active_record/connection_adapters/oracle_enhanced_schema_creation.rb
227
- - lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb
228
- - lib/active_record/connection_adapters/oracle_enhanced_schema_dumper.rb
229
- - lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb
230
- - lib/active_record/connection_adapters/oracle_enhanced_schema_statements_ext.rb
231
- - lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb
232
- - lib/active_record/connection_adapters/oracle_enhanced_version.rb
233
+ - lib/active_record/oracle_enhanced/type/integer.rb
234
+ - lib/active_record/oracle_enhanced/type/raw.rb
235
+ - lib/active_record/oracle_enhanced/type/timestamp.rb
233
236
  - lib/activerecord-oracle_enhanced-adapter.rb
234
237
  - spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
235
238
  - spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
@@ -244,6 +247,7 @@ files:
244
247
  - spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
245
248
  - spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb
246
249
  - spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
250
+ - spec/spec_config.yaml.template
247
251
  - spec/spec_helper.rb
248
252
  homepage: http://github.com/rsim/oracle-enhanced
249
253
  licenses:
@@ -260,12 +264,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
264
  version: '0'
261
265
  required_rubygems_version: !ruby/object:Gem::Requirement
262
266
  requirements:
263
- - - ">="
267
+ - - ">"
264
268
  - !ruby/object:Gem::Version
265
- version: '0'
269
+ version: 1.3.1
266
270
  requirements: []
267
271
  rubyforge_project:
268
- rubygems_version: 2.4.6
272
+ rubygems_version: 2.4.8
269
273
  signing_key:
270
274
  specification_version: 4
271
275
  summary: Oracle enhanced adapter for ActiveRecord
@@ -1,77 +0,0 @@
1
- module ActiveRecord #:nodoc:
2
- module ConnectionAdapters #:nodoc:
3
- module OracleEnhancedColumnDumper #:nodoc:
4
-
5
- def self.included(base) #:nodoc:
6
- base.class_eval do
7
- private
8
- alias_method_chain :column_spec, :oracle_enhanced
9
- alias_method_chain :prepare_column_options, :oracle_enhanced
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
22
- end
23
- end
24
-
25
- def column_spec_with_oracle_enhanced(column, types)
26
- # return original method if not using 'OracleEnhanced'
27
- return column_spec_without_oracle_enhanced(column, types) unless oracle_enhanced_adapter?
28
-
29
- spec = prepare_column_options(column, types)
30
- (spec.keys - [:name, :type]).each do |k|
31
- key_s = (k == :virtual_type ? "type: " : "#{k.to_s}: ")
32
- spec[k] = key_s + spec[k]
33
- end
34
- spec
35
- end
36
-
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
-
41
- spec = {}
42
-
43
- spec[:name] = column.name.inspect
44
- spec[:type] = column.virtual? ? 'virtual' : column.type.to_s
45
- spec[:limit] = column.limit.inspect if column.limit != types[column.type][:limit] && column.type != :decimal
46
- spec[:precision] = column.precision.inspect if !column.precision.nil?
47
- spec[:scale] = column.scale.inspect if !column.scale.nil?
48
- spec[:null] = 'false' if !column.null
49
- spec[:as] = column.virtual_column_data_default if column.virtual?
50
- spec[:default] = default_string(column.default) if column.has_default? && !column.virtual?
51
-
52
- if column.virtual?
53
- # Supports backwards compatibility with older OracleEnhancedAdapter versions where 'NUMBER' virtual column type is not included in dump
54
- if column.sql_type != "NUMBER" || ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.number_datatype_coercion != :decimal
55
- spec[:virtual_type] = column.type.inspect
56
- end
57
- end
58
-
59
- spec
60
- end
61
-
62
- def migration_keys_with_oracle_enhanced
63
- # TODO `& column_specs.map(&:keys).flatten` should be exetuted here
64
- # return original method if not using 'OracleEnhanced'
65
- return migration_keys_without_oracle_enhanced unless oracle_enhanced_adapter?
66
-
67
- [:name, :limit, :precision, :scale, :default, :null, :as, :virtual_type]
68
- end
69
-
70
-
71
- end
72
- end
73
- end
74
-
75
- ActiveRecord::ConnectionAdapters::ColumnDumper.class_eval do
76
- include ActiveRecord::ConnectionAdapters::OracleEnhancedColumnDumper
77
- end