schema_plus 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd63024eb3b8a4b7bb36531835ff82f9d12a460c
4
- data.tar.gz: 562ec9f5158688f44dbab8684447072901d28353
3
+ metadata.gz: 14f770e20ed8fc7090ddc3fd58e95976e6a6ae13
4
+ data.tar.gz: 999f0ad6bd7a1346dda3ebc152ec2a0f7a430488
5
5
  SHA512:
6
- metadata.gz: 4861cf3dce2acd2d90955fbce6afe974c3bff1f999d0412b0a11d09beb301bff4843d703ec647772c101cadd3529fa0267e874a1d19ec476c0fefca68780a72f
7
- data.tar.gz: 8463ee8647ba6a48a90f2c896e016191092d368518c0fa883ca256316d53a15def6b9bff3408b7067d8383dc9634440ce051fb4b62f50390dbbb62a428ffc101
6
+ metadata.gz: 33fdfaee05d32853f87112adc5d156970f4d5bddec6c2f8379a283ad16cf6e9eb3e5adfb84dbf60af476e340f51c15ab6f53d2336877226e670602bbf141d35e
7
+ data.tar.gz: 3ff056bfd48ea22a5004f3f6760d4bec52127bde7040b65082f2de86fcf00b1353be1a1f46a6b1d37dc04ab87ef0cb6f8146578d985cb126d118b77a670dc124
data/README.md CHANGED
@@ -76,7 +76,7 @@ You can also create multi-column indexes, for example:
76
76
 
77
77
  t.string :country_code
78
78
  t.string :area_code
79
- t.string :local_number index: { with: [:country_code, :area_code], unique: true }
79
+ t.string :local_number, index: { with: [:country_code, :area_code], unique: true }
80
80
 
81
81
  And you can specify index orders:
82
82
 
@@ -298,6 +298,11 @@ of foreign key constraints, you can re-enable it:
298
298
 
299
299
  * *nothing currently waiting to be released*
300
300
 
301
+
302
+ ### 1.5.1
303
+
304
+ * Now respects ActiveRecord::SchemaDumper.ignore_tables for views (issue #153)
305
+
301
306
  ### 1.5.0
302
307
  * Can now be used with activerecord standalone, doesn't need all of rails.
303
308
  * `views` ignores postgres internal views, thanks to [@everplays](https://github.com/everplays) (issue #147)
@@ -52,6 +52,7 @@ module SchemaPlus
52
52
  tables_without_schema_plus(nil)
53
53
 
54
54
  @connection.views.each do |view_name|
55
+ next if Array.wrap(::ActiveRecord::SchemaDumper.ignore_tables).any? {|pattern| view_name.match pattern}
55
56
  definition = @connection.view_definition(view_name)
56
57
  @table_dumps[view_name] = " create_view #{view_name.inspect}, #{definition.inspect}, :force => true\n"
57
58
  end
@@ -1,3 +1,3 @@
1
1
  module SchemaPlus
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -17,13 +17,6 @@ describe ActiveRecord do
17
17
 
18
18
  let(:connection) { ActiveRecord::Base.connection }
19
19
 
20
- let (:dump) {
21
- StringIO.open { |stream|
22
- ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
23
- stream.string
24
- }
25
- }
26
-
27
20
  context "views" do
28
21
 
29
22
  around (:each) do |example|
@@ -59,6 +52,14 @@ describe ActiveRecord do
59
52
  dump.should match(%r{create_table "items".*create_view "a_ones".*create_view "ab_ones"}m)
60
53
  end
61
54
 
55
+ it "should not be included in schema if listed in ignore_tables" do
56
+ dump(ignore_tables: /b_/) do |dump|
57
+ dump.should match(%r{create_view "a_ones", "SELECT .*b.*,.*s.* FROM .*items.* WHERE .*a.* = 1.*, :force => true}i)
58
+ dump.should_not match(%r{"ab_ones"})
59
+ end
60
+ end
61
+
62
+
62
63
  it "dump should not reference current database" do
63
64
  # why check this? mysql default to providing the view definition
64
65
  # with tables explicitly scoped to the current database, which
@@ -164,9 +165,11 @@ describe ActiveRecord do
164
165
  end
165
166
  end
166
167
 
167
- def dump
168
+ def dump(opts={})
168
169
  StringIO.open { |stream|
170
+ ActiveRecord::SchemaDumper.ignore_tables = Array.wrap(opts[:ignore_tables])
169
171
  ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
172
+ yield stream.string if block_given?
170
173
  stream.string
171
174
  }
172
175
  end
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.5.0
4
+ version: 1.5.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-04-02 00:00:00.000000000 Z
12
+ date: 2014-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord