schema_plus 1.8.0 → 1.8.1

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: 8894d9c9a340bef4433ef8cdafeda27802aea3d7
4
- data.tar.gz: e9f724492b719a928460d071891af9aa98ab2a9e
3
+ metadata.gz: f00387f0bf66660aab6b1f709a62fce866066d56
4
+ data.tar.gz: 5ade39b8c3bc992972ee8abbebfd875a5184da5a
5
5
  SHA512:
6
- metadata.gz: 1959ab185f75834d483af81b45009ea13678528bab3f3fdfa9799cb2a136fac56167a6683e31144fded7e26399b6f02f75bc82951ee937d5b1167a83112874cc
7
- data.tar.gz: ef5155047bc0700c50f0a8d8dee7c8632c0c7c7025ea37ee6181801cf59d5aa316bf23856106e67d9d8742173a8726bf3730df25000dc7fdd5077a6c31d85ac1
6
+ metadata.gz: 4108531c8c1eba2925ceca04f2e40d859f53cbd9c8f32a45630cd4f29435cc593378ea18bbb188cf5bc7f1344ebe840802987b5909bbea63f7ac877bf889b765
7
+ data.tar.gz: 70f615c970117764694a12739e2fa461a88775fff9e9d969106558cb4c71e994e6a8dd6be8386a31b42d7e4ebf7b277b3bb3b42487d2c79fb3027506cb825032
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Change Log
4
4
 
5
+ ## 1.8.1
6
+
7
+ * Bug fix for AR 4.2, spurious add_foreign_key statements at the top of schema dump. Thanks to [@tovodeverett](https://github.com/tovodeverett) for doing better testing than me!
8
+
5
9
  ## 1.8.0
6
10
 
7
11
  * Rails 4.2 now supported. Thanks to [@methodmissing](https://github.com/methodmissing) and [@dimonzozo](https://github.com/dimonzozo)
@@ -26,11 +26,17 @@ module SchemaPlus
26
26
  alias_method_chain :table, :schema_plus
27
27
  alias_method_chain :tables, :schema_plus
28
28
  alias_method_chain :indexes, :schema_plus
29
+ alias_method_chain :foreign_keys, :schema_plus if private_method_defined? :foreign_keys
29
30
  end
30
31
  end
31
32
 
32
33
  private
33
34
 
35
+ def foreign_keys_with_schema_plus(*)
36
+ # do nothing. this overrides AR 4.2's foreign key dumping method, which isn't needed
37
+ # because we're dong them inline
38
+ end
39
+
34
40
  def break_fk_cycles #:nodoc:
35
41
  strongly_connected_components.select{|component| component.size > 1}.each do |tables|
36
42
  table = tables.sort.first
@@ -1,3 +1,3 @@
1
1
  module SchemaPlus
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
3
3
  end
@@ -59,6 +59,13 @@ describe "Schema dump" do
59
59
  end
60
60
  end
61
61
 
62
+ it "should include foreign_key exactly once" do
63
+ with_foreign_key Post, :user_id, :users, :id, :name => "yippee" do
64
+ expect(dump_posts.scan(/foreign_key.*yippee"/).length).to eq 1
65
+ end
66
+ end
67
+
68
+
62
69
  it "should sort foreign_key definitions" do
63
70
  with_foreign_keys Comment, [ [ :post_id, :posts, :id ], [ :commenter_id, :users, :id ]] do
64
71
  expect(dump_schema).to match(/foreign_key.+commenter_id.+foreign_key.+post_id/m)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronen Barzel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-30 00:00:00.000000000 Z
12
+ date: 2014-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord