activerecord-oracle_enhanced-adapter 1.6.0.beta1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0666c234c8895bc18f1fa4c031c0f8a3990d2a16
4
- data.tar.gz: be6e762e334b31cced2092ff0ba5cea2dd0ac534
3
+ metadata.gz: fd6c2c33f02b87cf6022cfe64bf057a9ed992554
4
+ data.tar.gz: c7358edd06e352897de691eb71ed140ba6518b0b
5
5
  SHA512:
6
- metadata.gz: f975ab990ef8c3ddc397141ad3d8cf432a9518f6fea12f1405e3cc5e5b498c0de9dff555605ade1bb844e1c2754149569e4c73fdf140b61bc80b2620a6564906
7
- data.tar.gz: 47a94ecdc4670af38ae4e138d6e2ca96c76622cd96e1d39084d1af9d16a1a8c0a3892749d32604d57f97eb6f1cbaa10de9fda46066466ef4a10478288b1d6da5
6
+ metadata.gz: c16fb1f0555c03526c8d0cd3c3fad645d1b905749f87dba95e5d7e4465be43a08a3f4766aa26a621f04ab9d3ca5856f831538e5127b97780f94e8b941e6f25ca
7
+ data.tar.gz: f8914aa9fc1ee082c39015f42c10e9edef0f32841b4d855e9b1da9d45d6ab6d80bddda6bb5b1cf0010b6b28b6b2af2d6feefb841acc7a8ca2618c143dd8f0cc8
data/History.md CHANGED
@@ -1,5 +1,25 @@
1
- ## 1.6.0.beta 1 / 2016-06-19
2
- * Enhancements and bug fix
1
+ ## 1.6.0 / 2015-06-25
2
+
3
+ * Changes and bug fixes since 1.6.0.beta1
4
+
5
+ * Add deprecation warnings for Oracle enhanced specific foreign key methods [#631]
6
+ * Skip composite foreign key tests not supported in this version [#632]
7
+ * Do not dump default foreign key name [#633]
8
+ * Schema dump uses `:on_delete` option instead of `:dependent` [#634]
9
+ * Use Rails foreign key name in rspec unit tests [#635]
10
+ * Add deprecate warning if foreign key name length is longer than 30 byte [#636]
11
+ * Foreign key name longer than 30 byte will be shortened using Digest::SHA1.hexdigest [#637]
12
+ * Schema dumper for :integer will not dump :precision 0 [#638]
13
+ * Update foreign key names for add_foreign_key with table_name_prefix [#643]
14
+
15
+ * Known Issues since 1.6.0.beta1
16
+ * table_name_prefix and table_name_suffix changes column names which cause ORA-00904 [#639]
17
+ * custom methods should rollback record when exception is raised in after_create callback fails [#640]
18
+ * custom methods for create, update and destroy should log create record fails [#641]
19
+
20
+ ## 1.6.0.beta 1 / 2015-06-19
21
+
22
+ * Enhancements
3
23
  * Support Rails 4.2
4
24
  * Support Rails native foreign key syntax [#488, #618]
5
25
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.0.beta1
1
+ 1.6.0
@@ -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.0.beta1"
8
+ s.version = "1.6.0"
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-06-19}
13
+ s.date = %q{2015-06-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
  }
@@ -14,6 +14,7 @@ module ActiveRecord
14
14
  class ForeignKeyDefinition < ActiveRecord::ConnectionAdapters::ForeignKeyDefinition
15
15
  def name
16
16
  if options[:name].length > OracleEnhancedAdapter::IDENTIFIER_MAX_LENGTH
17
+ ActiveSupport::Deprecation.warn "Foreign key name #{options[:name]} is too long. It will not get shorten in later version of Oracle enhanced adapter"
17
18
  'c'+Digest::SHA1.hexdigest(options[:name])[0,OracleEnhancedAdapter::IDENTIFIER_MAX_LENGTH-1]
18
19
  else
19
20
  options[:name]
@@ -78,11 +79,13 @@ module ActiveRecord
78
79
 
79
80
  class Table < ActiveRecord::ConnectionAdapters::Table
80
81
  def foreign_key(to_table, options = {})
82
+ ActiveSupport::Deprecation.warn "`foreign_key` option will be deprecated. Please use `references` option"
81
83
  to_table = to_table.to_s.pluralize if ActiveRecord::Base.pluralize_table_names
82
84
  @base.add_foreign_key(@name, to_table, options)
83
85
  end
84
86
 
85
87
  def remove_foreign_key(options = {})
88
+ ActiveSupport::Deprecation.warn "`remove_foreign_key` option will be deprecated. Please use `remove_references` option"
86
89
  @base.remove_foreign_key(@name, options)
87
90
  end
88
91
  end
@@ -399,6 +399,9 @@ module ActiveRecord
399
399
  end
400
400
 
401
401
  def add_foreign_key(from_table, to_table, options = {})
402
+ if options[:dependent]
403
+ ActiveSupport::Deprecation.warn "`:dependent` option will be deprecated. Please use `:on_delete` option"
404
+ end
402
405
  case options[:dependent]
403
406
  when :delete then options[:on_delete] = :cascade
404
407
  when :nullify then options[:on_delete] = :nullify
@@ -180,21 +180,21 @@ describe "OracleEnhancedAdapter schema dump" do
180
180
  schema_define do
181
181
  add_foreign_key :test_comments, :test_posts
182
182
  end
183
- standard_dump.should =~ /add_foreign_key "test_comments", "test_posts", name: "test_comments_test_post_id_fk"/
183
+ standard_dump.should =~ /add_foreign_key "test_comments", "test_posts"/
184
184
  end
185
185
 
186
186
  it "should include foreign key with delete dependency in schema dump" do
187
187
  schema_define do
188
188
  add_foreign_key :test_comments, :test_posts, dependent: :delete
189
189
  end
190
- standard_dump.should =~ /add_foreign_key "test_comments", "test_posts", name: "test_comments_test_post_id_fk", dependent: :delete/
190
+ standard_dump.should =~ /add_foreign_key "test_comments", "test_posts", on_delete: :cascade/
191
191
  end
192
192
 
193
193
  it "should include foreign key with nullify dependency in schema dump" do
194
194
  schema_define do
195
195
  add_foreign_key :test_comments, :test_posts, dependent: :nullify
196
196
  end
197
- standard_dump.should =~ /add_foreign_key "test_comments", "test_posts", name: "test_comments_test_post_id_fk", dependent: :nullify/
197
+ standard_dump.should =~ /add_foreign_key "test_comments", "test_posts", on_delete: :nullify/
198
198
  end
199
199
 
200
200
  it "should not include foreign keys on ignored table names in schema dump" do
@@ -226,6 +226,7 @@ describe "OracleEnhancedAdapter schema dump" do
226
226
  end
227
227
 
228
228
  it "should include composite foreign keys" do
229
+ pending "Composite foreign keys are not supported in this version"
229
230
  schema_define do
230
231
  add_column :test_posts, :baz_id, :integer
231
232
  add_column :test_posts, :fooz_id, :integer
@@ -405,7 +406,7 @@ describe "OracleEnhancedAdapter schema dump" do
405
406
  it 'should dump correctly' do
406
407
  standard_dump.should =~ /t\.virtual "full_name",(\s*)limit: 512,(\s*)as: "\\"FIRST_NAME\\"\|\|', '\|\|\\"LAST_NAME\\"",(\s*)type: :string/
407
408
  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 "full_name_length",(\s*)precision: 38,(\s*)as:(.*),(\s*)type: :integer/
409
410
  standard_dump.should =~ /t\.virtual "name_ratio",(\s*)as:(.*)\"$/ # no :type
410
411
  standard_dump.should =~ /t\.virtual "abbrev_name",(\s*)limit: 100,(\s*)as:(.*),(\s*)type: :string/
411
412
  standard_dump.should =~ /t\.virtual "field_with_leading_space",(\s*)limit: 300,(\s*)as: "' '\|\|\\"FIRST_NAME\\"\|\|' '",(\s*)type: :string/
@@ -627,25 +627,28 @@ end
627
627
  end
628
628
 
629
629
  it "should add foreign key" do
630
+ fk_name = "fk_rails_#{Digest::SHA256.hexdigest("test_comments_test_post_id_fk").first(10)}"
631
+
630
632
  schema_define do
631
633
  add_foreign_key :test_comments, :test_posts
632
634
  end
633
635
  lambda do
634
636
  TestComment.create(:body => "test", :test_post_id => 1)
635
- end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.TEST_COMMENTS_TEST_POST_ID_FK/}
637
+ end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.#{fk_name}/i}
636
638
  end
637
639
 
638
640
  context "with table_name_prefix" do
639
641
  let(:table_name_prefix) { 'xxx_' }
640
642
 
641
643
  it "should use table_name_prefix for foreign table" do
644
+ fk_name = "fk_rails_#{Digest::SHA256.hexdigest("xxx_test_comments_test_post_id_fk").first(10)}"
642
645
  schema_define do
643
646
  add_foreign_key :test_comments, :test_posts
644
647
  end
645
648
 
646
649
  lambda do
647
650
  TestComment.create(:body => "test", :test_post_id => 1)
648
- end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.XXX_TES_COM_TES_POS_ID_FK/}
651
+ end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.#{fk_name}/i}
649
652
  end
650
653
  end
651
654
 
@@ -653,13 +656,14 @@ end
653
656
  let(:table_name_suffix) { '_xxx' }
654
657
 
655
658
  it "should use table_name_suffix for foreign table" do
659
+ fk_name = "fk_rails_#{Digest::SHA256.hexdigest("test_comments_xxx_test_post_id_fk").first(10)}"
656
660
  schema_define do
657
661
  add_foreign_key :test_comments, :test_posts
658
662
  end
659
663
 
660
664
  lambda do
661
665
  TestComment.create(:body => "test", :test_post_id => 1)
662
- end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.TES_COM_XXX_TES_POS_ID_FK/}
666
+ end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.#{fk_name}/i}
663
667
  end
664
668
  end
665
669
 
@@ -678,7 +682,8 @@ end
678
682
  end
679
683
  lambda do
680
684
  TestComment.create(:body => "test", :test_post_id => 1)
681
- end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.TES_COM_TES_POS_ID_FOR_KEY/}
685
+ end.should raise_error() {|e| e.message.should =~
686
+ /ORA-02291.*\.C#{Digest::SHA1.hexdigest("test_comments_test_post_id_foreign_key")[0,29].upcase}/}
682
687
  end
683
688
 
684
689
  it "should add foreign key with very long name which is shortened" do
@@ -692,12 +697,14 @@ end
692
697
  end
693
698
 
694
699
  it "should add foreign key with column" do
700
+ fk_name = "fk_rails_#{Digest::SHA256.hexdigest("test_comments_post_id_fk").first(10)}"
701
+
695
702
  schema_define do
696
703
  add_foreign_key :test_comments, :test_posts, :column => "post_id"
697
704
  end
698
705
  lambda do
699
706
  TestComment.create(:body => "test", :post_id => 1)
700
- end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.TEST_COMMENTS_POST_ID_FK/}
707
+ end.should raise_error() {|e| e.message.should =~ /ORA-02291.*\.#{fk_name}/i}
701
708
  end
702
709
 
703
710
  it "should add foreign key with delete dependency" do
@@ -721,6 +728,7 @@ end
721
728
  end
722
729
 
723
730
  it "should add a composite foreign key" do
731
+ pending "Composite foreign keys are not supported in this version"
724
732
  schema_define do
725
733
  add_column :test_posts, :baz_id, :integer
726
734
  add_column :test_posts, :fooz_id, :integer
@@ -743,6 +751,7 @@ end
743
751
  end
744
752
 
745
753
  it "should add a composite foreign key with name" do
754
+ pending "Composite foreign keys are not supported in this version"
746
755
  schema_define do
747
756
  add_column :test_posts, :baz_id, :integer
748
757
  add_column :test_posts, :fooz_id, :integer
@@ -92,6 +92,7 @@ describe "OracleEnhancedAdapter structure dump" do
92
92
  end
93
93
 
94
94
  it "should dump composite foreign keys" do
95
+ pending "Composite foreign keys are not supported in this version"
95
96
  @conn.add_column :foos, :fooz_id, :integer
96
97
  @conn.add_column :foos, :baz_id, :integer
97
98
 
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.0.beta1
4
+ version: 1.6.0
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-06-19 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeweler
@@ -264,9 +264,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
264
  version: '0'
265
265
  required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  requirements:
267
- - - ">"
267
+ - - ">="
268
268
  - !ruby/object:Gem::Version
269
- version: 1.3.1
269
+ version: '0'
270
270
  requirements: []
271
271
  rubyforge_project:
272
272
  rubygems_version: 2.4.8