mini_record 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -5
- data/lib/mini_record/auto_schema.rb +13 -3
- data/lib/mini_record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54cb420cd8731059dd9c17ae15191718a354b6ae
|
|
4
|
+
data.tar.gz: 3d3b76d3752e50992241c052051a84055a37362f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c782dd8fb168ef3e0254b30bfe99262b12c0685a4ce3c3d2c5ae314b0b4dd236761d1005641d42915c3b7f70ca448e5667a9454ff30a7e0c312cbbae2e29b260
|
|
7
|
+
data.tar.gz: 93f5207799aee9b3e735e94b348907297fdb0a1d0bc31166a5d1af94778a89d9e8668752885ecda649ebffcbf983ffe4cf0bacda62d7aaccaf9ff3e84e7d00ed
|
data/.travis.yml
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
291
|
-
|
|
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} " +
|
data/lib/mini_record/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|