mini_record 0.3.8 → 0.3.9

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: bbc6265309e053275dc3dd32840f6b5ed878d950
4
- data.tar.gz: 66a0d5716fa446d1583533c7d29bd716cbac5e33
3
+ metadata.gz: 54cb420cd8731059dd9c17ae15191718a354b6ae
4
+ data.tar.gz: 3d3b76d3752e50992241c052051a84055a37362f
5
5
  SHA512:
6
- metadata.gz: 06634731e1e072c1d8894560d6f547ea0759513cc8d25f88afabb673789ef84dfe858ac99d21082237b41f9242db850d70e3a0747c9bde8bd0d2f4ba5a9bb708
7
- data.tar.gz: e9316a2df43aaeafdf191d4a592e7e27ea2ad009417d61070458db204cd804a811b1f5ea24316aafa05caa5c27a726415579f07fdefc9c48a876fe0700b3ad69
6
+ metadata.gz: c782dd8fb168ef3e0254b30bfe99262b12c0685a4ce3c3d2c5ae314b0b4dd236761d1005641d42915c3b7f70ca448e5667a9454ff30a7e0c312cbbae2e29b260
7
+ data.tar.gz: 93f5207799aee9b3e735e94b348907297fdb0a1d0bc31166a5d1af94778a89d9e8668752885ecda649ebffcbf983ffe4cf0bacda62d7aaccaf9ff3e84e7d00ed
data/.travis.yml CHANGED
@@ -1,12 +1,8 @@
1
1
  language: ruby
2
2
  before_install: 'gem update --system'
3
3
  rvm:
4
- - 1.8.7
5
- - 1.9.2
6
4
  - 1.9.3
7
- - rbx-18mode
8
- - rbx
9
- - ree
5
+ - 2.1.0
10
6
  notifications:
11
7
  recipients:
12
8
  - info@daddye.it
@@ -270,7 +270,12 @@ module MiniRecord
270
270
  old_sql_type = get_sql_field_type(fields_in_db[field])
271
271
  new_sql_type = get_sql_field_type(fields[field])
272
272
 
273
- if old_sql_type != new_sql_type
273
+ # Strip off the "(10,0)", from "decimal(10,0)" - we re-check this below.
274
+ # This is all a bit hacky but different versions of Rails act differently.
275
+ old_base_type = old_sql_type.sub(/\(.*/,'')
276
+ new_base_type = new_sql_type.sub(/\(.*/,'')
277
+
278
+ if old_sql_type != new_sql_type and old_base_type != new_base_type
274
279
  logger.debug "[MiniRecord] Detected schema change for #{table_name}.#{field}#type " +
275
280
  " from #{old_sql_type.inspect} to #{new_sql_type.inspect}" if logger
276
281
  changed = true
@@ -287,9 +292,14 @@ module MiniRecord
287
292
  # Next, iterate through our extended attributes, looking for any differences
288
293
  # This catches stuff like :null, :precision, etc
289
294
  # Ignore junk attributes that different versions of Rails include
290
- fields[field].each_pair do |att,value|
291
- next unless [:name, :limit, :precision, :scale, :default, :null].include?(att)
295
+ [:name, :limit, :precision, :scale, :default, :null].each do |att|
296
+ value = fields[field][att]
292
297
  value = true if att == :null && value.nil?
298
+
299
+ # Skip unspecified limit/precision/scale as DB will set them to defaults,
300
+ # and on subsequent runs, this will be erroneously detected as a change.
301
+ next if value.nil? and [:limit, :precision, :scale].include?(att)
302
+
293
303
  old_value = fields_in_db[field].send(att)
294
304
  if value != old_value
295
305
  logger.debug "[MiniRecord] Detected schema change for #{table_name}.#{field}##{att} " +
@@ -1,3 +1,3 @@
1
1
  module MiniRecord
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide D'Agostino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-22 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord